Class: Noise::Functions::Hash::Blake2bDigester

Inherits:
OpenSSL::Digest
  • Object
show all
Defined in:
lib/noise/functions/hash/blake2b.rb

Overview

Builds an OpenSSL BLAKE2b digest with no argument, which is how HMAC::Base creates the digests it feeds the inner and outer blocks to. OpenSSL defines no OpenSSL::Digest::BLAKE2b512 constant, so the algorithm name is bound here instead of being passed in at every call.

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeBlake2bDigester

Returns a new instance of Blake2bDigester.



32
33
34
# File 'lib/noise/functions/hash/blake2b.rb', line 32

def initialize
  super(Blake2b::DIGEST_NAME)
end

Class Method Details

.digest(data) ⇒ Object

HMAC::Base hashes a key longer than the block size through this class method. The one inherited from OpenSSL::Digest takes the algorithm name as its first argument, which this class has already bound, so it is redefined to take the data alone.



39
40
41
# File 'lib/noise/functions/hash/blake2b.rb', line 39

def self.digest(data)
  new.digest(data)
end