Sha256: 7ba9e5136f08c9c52861792c9e5eb9a6e0f244cd1b69d7a7905026ac78ec535a
Contents?: true
Size: 922 Bytes
Versions: 17
Compression:
Stored size: 922 Bytes
Contents
module Sorcery module CryptoProviders module Common def self.included(base) base.class_eval do class << self attr_accessor :join_token # The number of times to loop through the encryption. def stretches @stretches ||= 1 end attr_writer :stretches def encrypt(*tokens) digest = tokens.flatten.compact.join(join_token) stretches.times { digest = secure_digest(digest) } digest end # Does the crypted password match the tokens? Uses the same tokens that were used to encrypt. def matches?(crypted, *tokens) encrypt(*tokens.compact) == crypted end def reset! @stretches = 1 @join_token = nil end end end end end end end
Version data entries
17 entries across 17 versions & 1 rubygems