Class: IsccLib::InstanceHasher

Inherits:
Object
  • Object
show all
Defined in:
lib/iscc_lib.rb

Overview

Streaming Instance-Code generator (reopens native class).

Incrementally hashes data with BLAKE3 to produce results identical to gen_instance_code_v0.

Examples:

hasher = IsccLib::InstanceHasher.new
hasher.update(chunk1).update(chunk2)
result = hasher.finalize(bits: 64)

Instance Method Summary collapse

Instance Method Details

#finalize(bits: 64) ⇒ InstanceCodeResult

Consume the hasher and produce an Instance-Code result.

Parameters:

  • bits (Integer) (defaults to: 64)

    bit length (default: 64)

Returns:

Raises:

  • (RuntimeError)

    if called more than once



231
232
233
# File 'lib/iscc_lib.rb', line 231

def finalize(bits: 64)
  InstanceCodeResult[_finalize(bits)]
end

#update(data) ⇒ self

Push binary data into the hasher.

Parameters:

  • data (String)

    binary data

Returns:

  • (self)

    for method chaining



221
222
223
224
# File 'lib/iscc_lib.rb', line 221

def update(data)
  _update(data)
  self
end