Class: Enigma::Verifier
- Inherits:
-
Object
- Object
- Enigma::Verifier
- Defined in:
- lib/enigma/verifier.rb
Overview
Verifies the password by comparing it with the stored hash.
Instance Attribute Summary collapse
-
#base64_salt_separator ⇒ String
readonly
The base64-encoded salt separator.
-
#base64_signer_key ⇒ String
readonly
The base64-encoded signer key.
-
#mem_cost ⇒ Integer
readonly
The memory cost used for password hashing.
-
#password_to_check ⇒ String
readonly
The password to be checked.
-
#rounds ⇒ Integer
readonly
The number of rounds used for password hashing.
-
#stored_hash_base64 ⇒ String
readonly
The base64-encoded stored hash.
-
#target_salt_base64 ⇒ String
readonly
The base64-encoded user salt.
Instance Method Summary collapse
-
#initialize(password_to_check:, target_salt_base64:, stored_hash_base64:) ⇒ Verifier
constructor
A new instance of Verifier.
- #verify ⇒ Object
Constructor Details
#initialize(password_to_check:, target_salt_base64:, stored_hash_base64:) ⇒ Verifier
Returns a new instance of Verifier.
25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/enigma/verifier.rb', line 25 def initialize(password_to_check:, target_salt_base64:, stored_hash_base64:) check_args(password_to_check, target_salt_base64, stored_hash_base64, Enigma.base64_signer_key, Enigma.base64_salt_separator, Enigma.rounds, Enigma.mem_cost) @password_to_check = password_to_check @target_salt_base64 = target_salt_base64 @stored_hash_base64 = stored_hash_base64 @base64_signer_key = Enigma.base64_signer_key @base64_salt_separator = Enigma.base64_salt_separator @rounds = Enigma.rounds @mem_cost = Enigma.mem_cost end |
Instance Attribute Details
#base64_salt_separator ⇒ String (readonly)
Returns The base64-encoded salt separator.
25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/enigma/verifier.rb', line 25 def initialize(password_to_check:, target_salt_base64:, stored_hash_base64:) check_args(password_to_check, target_salt_base64, stored_hash_base64, Enigma.base64_signer_key, Enigma.base64_salt_separator, Enigma.rounds, Enigma.mem_cost) @password_to_check = password_to_check @target_salt_base64 = target_salt_base64 @stored_hash_base64 = stored_hash_base64 @base64_signer_key = Enigma.base64_signer_key @base64_salt_separator = Enigma.base64_salt_separator @rounds = Enigma.rounds @mem_cost = Enigma.mem_cost end |
#base64_signer_key ⇒ String (readonly)
Returns The base64-encoded signer key.
25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/enigma/verifier.rb', line 25 def initialize(password_to_check:, target_salt_base64:, stored_hash_base64:) check_args(password_to_check, target_salt_base64, stored_hash_base64, Enigma.base64_signer_key, Enigma.base64_salt_separator, Enigma.rounds, Enigma.mem_cost) @password_to_check = password_to_check @target_salt_base64 = target_salt_base64 @stored_hash_base64 = stored_hash_base64 @base64_signer_key = Enigma.base64_signer_key @base64_salt_separator = Enigma.base64_salt_separator @rounds = Enigma.rounds @mem_cost = Enigma.mem_cost end |
#mem_cost ⇒ Integer (readonly)
Returns The memory cost used for password hashing.
25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/enigma/verifier.rb', line 25 def initialize(password_to_check:, target_salt_base64:, stored_hash_base64:) check_args(password_to_check, target_salt_base64, stored_hash_base64, Enigma.base64_signer_key, Enigma.base64_salt_separator, Enigma.rounds, Enigma.mem_cost) @password_to_check = password_to_check @target_salt_base64 = target_salt_base64 @stored_hash_base64 = stored_hash_base64 @base64_signer_key = Enigma.base64_signer_key @base64_salt_separator = Enigma.base64_salt_separator @rounds = Enigma.rounds @mem_cost = Enigma.mem_cost end |
#password_to_check ⇒ String (readonly)
Returns The password to be checked.
25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/enigma/verifier.rb', line 25 def initialize(password_to_check:, target_salt_base64:, stored_hash_base64:) check_args(password_to_check, target_salt_base64, stored_hash_base64, Enigma.base64_signer_key, Enigma.base64_salt_separator, Enigma.rounds, Enigma.mem_cost) @password_to_check = password_to_check @target_salt_base64 = target_salt_base64 @stored_hash_base64 = stored_hash_base64 @base64_signer_key = Enigma.base64_signer_key @base64_salt_separator = Enigma.base64_salt_separator @rounds = Enigma.rounds @mem_cost = Enigma.mem_cost end |
#rounds ⇒ Integer (readonly)
Returns The number of rounds used for password hashing.
25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/enigma/verifier.rb', line 25 def initialize(password_to_check:, target_salt_base64:, stored_hash_base64:) check_args(password_to_check, target_salt_base64, stored_hash_base64, Enigma.base64_signer_key, Enigma.base64_salt_separator, Enigma.rounds, Enigma.mem_cost) @password_to_check = password_to_check @target_salt_base64 = target_salt_base64 @stored_hash_base64 = stored_hash_base64 @base64_signer_key = Enigma.base64_signer_key @base64_salt_separator = Enigma.base64_salt_separator @rounds = Enigma.rounds @mem_cost = Enigma.mem_cost end |
#stored_hash_base64 ⇒ String (readonly)
Returns The base64-encoded stored hash.
25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/enigma/verifier.rb', line 25 def initialize(password_to_check:, target_salt_base64:, stored_hash_base64:) check_args(password_to_check, target_salt_base64, stored_hash_base64, Enigma.base64_signer_key, Enigma.base64_salt_separator, Enigma.rounds, Enigma.mem_cost) @password_to_check = password_to_check @target_salt_base64 = target_salt_base64 @stored_hash_base64 = stored_hash_base64 @base64_signer_key = Enigma.base64_signer_key @base64_salt_separator = Enigma.base64_salt_separator @rounds = Enigma.rounds @mem_cost = Enigma.mem_cost end |
#target_salt_base64 ⇒ String (readonly)
Returns The base64-encoded user salt.
25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/enigma/verifier.rb', line 25 def initialize(password_to_check:, target_salt_base64:, stored_hash_base64:) check_args(password_to_check, target_salt_base64, stored_hash_base64, Enigma.base64_signer_key, Enigma.base64_salt_separator, Enigma.rounds, Enigma.mem_cost) @password_to_check = password_to_check @target_salt_base64 = target_salt_base64 @stored_hash_base64 = stored_hash_base64 @base64_signer_key = Enigma.base64_signer_key @base64_salt_separator = Enigma.base64_salt_separator @rounds = Enigma.rounds @mem_cost = Enigma.mem_cost end |
Instance Method Details
#verify ⇒ Object
39 40 41 |
# File 'lib/enigma/verifier.rb', line 39 def verify verify_password end |