Class: FlexPass::Coders::SHA2Hash
- Inherits:
-
String
- Object
- String
- FlexPass::Coders::SHA2Hash
- Defined in:
- lib/flex_pass/coders/sha2_hash.rb
Direct Known Subclasses
Class Method Summary collapse
Instance Method Summary collapse
- #==(secret) ⇒ Object
-
#initialize(raw_hash, bit_len = 256) ⇒ SHA2Hash
constructor
A new instance of SHA2Hash.
Constructor Details
#initialize(raw_hash, bit_len = 256) ⇒ SHA2Hash
Returns a new instance of SHA2Hash.
12 13 14 15 |
# File 'lib/flex_pass/coders/sha2_hash.rb', line 12 def initialize(raw_hash, bit_len = 256) self.replace(raw_hash) @bit_len = bit_len end |
Class Method Details
.create(secret, bit_len = 256) ⇒ Object
7 8 9 |
# File 'lib/flex_pass/coders/sha2_hash.rb', line 7 def create(secret, bit_len = 256) SHA2Hash.new(Digest::SHA2.new(bit_len).hexdigest(secret), bit_len) end |
Instance Method Details
#==(secret) ⇒ Object
17 18 19 |
# File 'lib/flex_pass/coders/sha2_hash.rb', line 17 def ==(secret) super(Digest::SHA2.new(@bit_len).hexdigest(secret)) end |