Class: Sorcery::CryptoProviders::SHA1

Inherits:
Object
  • Object
show all
Includes:
Common
Defined in:
lib/sorcery/crypto_providers/sha1.rb

Overview

This class was made for the users transitioning from restful_authentication. I highly discourage using this crypto provider as it inferior to your other options. Please use any other provider offered by Sorcery.

Class Method Summary collapse

Methods included from Common

included

Class Method Details

.encrypt(*tokens) ⇒ Object

Turns your raw password into a Sha1 hash.



15
16
17
18
19
20
# File 'lib/sorcery/crypto_providers/sha1.rb', line 15

def encrypt(*tokens)
  tokens = tokens.flatten
  digest = tokens.shift
  stretches.times { digest = secure_digest([digest, *tokens].join(join_token)) }
  digest
end

.join_tokenObject



10
11
12
# File 'lib/sorcery/crypto_providers/sha1.rb', line 10

def join_token
  @join_token ||= '--'
end

.secure_digest(digest) ⇒ Object



22
23
24
# File 'lib/sorcery/crypto_providers/sha1.rb', line 22

def secure_digest(digest)
  Digest::SHA1.hexdigest(digest)
end