Class: H::Generator
- Inherits:
-
Object
- Object
- H::Generator
- Defined in:
- lib/h.rb
Overview
Class that generates cryptographic hash
Instance Method Summary collapse
-
#initialize(static_key) ⇒ H::Generator
constructor
Initialize a H instance.
-
#input(m, l) ⇒ String
Return a hash of
l
length.
Constructor Details
#initialize(static_key) ⇒ H::Generator
Initialize a H instance.
13 14 15 |
# File 'lib/h.rb', line 13 def initialize(static_key) @static_key = static_key end |
Instance Method Details
#input(m, l) ⇒ String
Return a hash of l
length.
25 26 27 28 29 |
# File 'lib/h.rb', line 25 def input(m, l) m += @static_key d = cryptographic_hash(m) truncate d, l end |