class Cryptomancer::Hash::Blake2bp

Defined in:

hash/blake2bp.cr

Constant Summary

BLOCK_SIZE = Blake2b::BLOCK_SIZE

Block size (inherited from Blake2b)

DEFAULT_FANOUT = 4_u8

Default number of parallel threads (fanout)

Constructors

Class Method Summary

Instance Method Summary

Constructor Detail

def self.new(digest_length : UInt8 = 64, fanout : UInt8 = DEFAULT_FANOUT, key : Bytes | Nil = nil, salt : Bytes | Nil = nil, personalization : Bytes | Nil = nil, as_bytes : Bool = false) #

Initialize BLAKE2bp hash context

  • digest_length - Output length in bytes (1-64, default: 64)
  • fanout - Number of parallel threads (1-255, default: 4)
  • key - Optional key for keyed hashing (MAC mode), max 64 bytes
  • salt - Optional salt, exactly 16 bytes
  • personalization - Optional personalization string, exactly 16 bytes

[View source]

Class Method Detail

def self.hash(data : String | Bytes, digest_length : UInt8 = 64, fanout : UInt8 = DEFAULT_FANOUT, as_bytes : Bool = false) : Bytes | String #

Compute hash of data


[View source]
def self.keyed_hash(data : String | Bytes, key : Bytes, digest_length : UInt8 = 64, fanout : UInt8 = DEFAULT_FANOUT, as_bytes : Bool = false) : Bytes | String #

Compute keyed hash (MAC mode)


[View source]

Instance Method Detail

def final : Bytes | String #

Finalize hash and return digest


[View source]
def update(data : Pointer(UInt8), length : Int32) : Nil #

Update hash with new data


[View source]
def update(data : Bytes) : Nil #

Update hash with new data Data is distributed across parallel leaf contexts


[View source]
def update(data : String) : Nil #

Update hash with new data


[View source]