Sha256: 1899645cfd9429e2fbc4e0c04a6b6e8bf0be4c5525a91855ef3807dbe9076561
Contents?: true
Size: 791 Bytes
Versions: 10
Compression:
Stored size: 791 Bytes
Contents
require "digest/sha1" module Devise module Encryptable module Encryptors # = Sha1 # Uses the Sha1 hash algorithm to encrypt passwords. class Sha1 < Base # Generates a default password digest based on stretches, salt, pepper and the # incoming password. def self.digest(password, stretches, salt, pepper) digest = pepper stretches.times { digest = self.secure_digest(salt, digest, password, pepper) } digest end private # Generate a SHA1 digest joining args. Generated token is something like # --arg1--arg2--arg3--argN-- def self.secure_digest(*tokens) ::Digest::SHA1.hexdigest('--' << tokens.flatten.join('--') << '--') end end end end end
Version data entries
10 entries across 10 versions & 2 rubygems