class
Cryptomancer::Hash::Blake2bp
- Cryptomancer::Hash::Blake2bp
- Reference
- Object
Defined in:
hash/blake2bp.crConstant Summary
-
BLOCK_SIZE =
Blake2b::BLOCK_SIZE -
Block size (inherited from Blake2b)
-
DEFAULT_FANOUT =
4_u8 -
Default number of parallel threads (fanout)
Constructors
-
.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
Class Method Summary
-
.hash(data : String | Bytes, digest_length : UInt8 = 64, fanout : UInt8 = DEFAULT_FANOUT, as_bytes : Bool = false) : Bytes | String
Compute hash of data
-
.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)
Instance Method Summary
-
#final : Bytes | String
Finalize hash and return digest
-
#update(data : Pointer(UInt8), length : Int32) : Nil
Update hash with new data
-
#update(data : Bytes) : Nil
Update hash with new data Data is distributed across parallel leaf contexts
-
#update(data : String) : Nil
Update hash with new data
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 bytessalt- Optional salt, exactly 16 bytespersonalization- Optional personalization string, exactly 16 bytes
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
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)
Instance Method Detail
def update(data : Bytes) : Nil
#
Update hash with new data Data is distributed across parallel leaf contexts