Sha256: ad7db632e958462244f050677c1a13bf6c629b8d07eac4c5c1923dbf3567c4b2

Contents?: true

Size: 433 Bytes

Versions: 5

Compression:

Stored size: 433 Bytes

Contents

class Auth::Encryptors::Sha512
  class << self
    attr_accessor :token_delimeter
    attr_writer :stretches
    
    def stretches
      @stretches ||= 20
    end
    
    def encrypt(*what)
      digest = what.flatten.join(token_delimeter)
      stretches.times { digest = Digest::SHA512.hexdigest(digest) }
      digest
    end
    
    def matches?(encrypted_copy, *what)
      encrypt(*what) == encrypted_copy
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
sparkly-auth-1.2.1 lib/auth/encryptors/sha512.rb
sparkly-auth-1.1.0 lib/auth/encryptors/sha512.rb
sparkly-auth-1.0.2 lib/auth/encryptors/sha512.rb
sparkly-auth-1.0.1 lib/auth/encryptors/sha512.rb
sparkly-auth-1.0.0 lib/auth/encryptors/sha512.rb