Class Method Details

.included(base) ⇒ Object

# File 'lib/sorcery/crypto_providers/common.rb', line 4defself.included(base)base.class_evaldoclass<<selfattr_accessor:join_token# The number of times to loop through the encryption.
defstretches@stretches||=1endattr_writer:stretchesdefencrypt(*tokens)digest=tokens.flatten.compact.join(join_token)stretches.times{digest=secure_digest(digest)}digestend# Does the crypted password match the tokens? Uses the same tokens that were used to encrypt.
defmatches?(crypted,*tokens)encrypt(*tokens.compact)==cryptedenddefreset!@stretches=1@join_token=nilendendendend