Documentation ¶
Overview ¶
Package guts provides a low-level interface to the BLAKE3 cryptographic hash function.
Index ¶
Constants ¶
const ( FlagChunkStart = 1 << iota FlagChunkEnd FlagParent FlagRoot FlagKeyedHash FlagDeriveKeyContext FlagDeriveKeyMaterial BlockSize = 64 ChunkSize = 1024 MaxSIMD = 16 // AVX-512 vectors can store 16 words )
Various constants.
Variables ¶
var IV = [8]uint32{
0x6A09E667, 0xBB67AE85, 0x3C6EF372, 0xA54FF53A,
0x510E527F, 0x9B05688C, 0x1F83D9AB, 0x5BE0CD19,
}
IV is the BLAKE3 initialization vector.
Functions ¶
func BytesToWords ¶
BytesToWords converts an array of 64 bytes to an array of 16 bytes.
func ChainingValue ¶
ChainingValue compresses n and returns the first 8 output words.
func CompressBlocks ¶
CompressBlocks compresses MaxSIMD copies of n with successive counter values, storing the results in out.
func CompressNode ¶
CompressNode compresses a node into a 16-word output.
func WordsToBytes ¶
WordsToBytes converts an array of 16 words to an array of 64 bytes.
Types ¶
type Node ¶
type Node struct { CV [8]uint32 // chaining value from previous node Block [16]uint32 Counter uint64 BlockLen uint32 Flags uint32 }
A Node represents a chunk or parent in the BLAKE3 Merkle tree.
func CompressBuffer ¶
func CompressBuffer(buf *[MaxSIMD * ChunkSize]byte, buflen int, key *[8]uint32, counter uint64, flags uint32) Node
CompressBuffer compresses up to MaxSIMD chunks in parallel and returns their root node.
func CompressChunk ¶
CompressChunk compresses a single chunk, returning its final (uncompressed) node.