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.



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

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

.join_tokenObject



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

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

.secure_digest(digest) ⇒ Object



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

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