Module: OMQ::Blake3ZMQ::Crypto::Hash

Defined in:
lib/omq/blake3zmq/crypto.rb

Overview

BLAKE3 hashing and key derivation functions.

Class Method Summary collapse

Class Method Details

.derive_key(context, material, size: 32) ⇒ String

Derives a key using BLAKE3 key derivation.

Parameters:

  • context (String)

    domain separation context string

  • material (String)

    input keying material

  • size (Integer) (defaults to: 32)

    output length in bytes (default 32)

Returns:

  • (String)

    derived key bytes



108
109
110
# File 'lib/omq/blake3zmq/crypto.rb', line 108

def derive_key(context, material, size: 32)
  ChaCha20Blake3.derive_key(context, material, length: size)
end

.digest(input) ⇒ String

Computes a 32-byte BLAKE3 digest.

Parameters:

  • input (String)

    data to hash

Returns:

  • (String)

    32-byte binary digest



97
98
99
# File 'lib/omq/blake3zmq/crypto.rb', line 97

def digest(input)
  Digest::Blake3.digest(input)
end