Files
herolib/aiprompts/v_core/crypto/blake3.md
2025-09-02 07:28:13 +02:00

2.4 KiB

module blake3

Contents

Constants

const size256 = 32

size256 is the size, in bytes, of a Blake3 256 checksum.

[Return to contents]

const key_length = 32

key_length is the length, in bytes, of a Blake3 key

[Return to contents]

const block_size = 64

block_size is the block size, in bytes, of the Blake3 hash functions.

[Return to contents]

const chunk_size = 1024

chunk_size is the chunk size, in bytes, of the Blake3 hash functions. A chunk consists of 16 blocks.

[Return to contents]

sum256

fn sum256(data []u8) []u8

sum256 returns the Blake3 256 bit hash of the data.

[Return to contents]

sum_derive_key256

fn sum_derive_key256(context []u8, key_material []u8) []u8

sum_derived_key256 returns the Blake3 256 bit derived key hash of the key material

[Return to contents]

sum_keyed256

fn sum_keyed256(data []u8, key []u8) []u8

sum_keyed256 returns the Blake3 256 bit keyed hash of the data.

[Return to contents]

Digest.new_derive_key_hash

fn Digest.new_derive_key_hash(context []u8) !Digest

Digest.new_derive_key_hash initializes a Digest structure for deriving a Blake3 key

[Return to contents]

Digest.new_hash

fn Digest.new_hash() !Digest

Digest.new_hash initializes a Digest structure for a Blake3 hash

[Return to contents]

Digest.new_keyed_hash

fn Digest.new_keyed_hash(key []u8) !Digest

Digest.new_keyed_hash initializes a Digest structure for a Blake3 keyed hash

[Return to contents]

Digest

write

fn (mut d Digest) write(data []u8) !

write adds bytes to the hash

[Return to contents]

checksum

fn (mut d Digest) checksum(size u64) []u8

checksum finalizes the hash and returns the generated bytes.

This is the point in the hashing operation that we need to know how many bytes of hash to generate. Normally this is 32 but can be any size up to 2**64.

[Return to contents]

Powered by vdoc. Generated on: 2 Sep 2025 07:18:17