package bao
Import Path
lukechampine.com/blake3/bao (on go.dev)
Dependency Relation
imports 6 packages, and imported by one package
Involved Source Files
Package bao implements BLAKE3 verified streaming.
Package-Level Functions (total 9)
Decode reads content and tree data from the provided reader(s), and
streams the verified content to dst. It returns false if verification fails.
If the content and tree data are interleaved, outboard should be nil.
DecodeSlice reads from data, which must contain a slice encoding for the
given offset and length, and streams verified content to dst. It returns
false if verification fails.
Encode computes the intermediate BLAKE3 tree hashes of data and writes them
to dst. If outboard is false, the contents of data are also written to dst,
interleaved with the tree hashes. It also returns the tree root, i.e. the
256-bit BLAKE3 hash. The group parameter controls how many chunks are hashed
per "group," as a power of 2; for standard Bao, use 0.
Note that dst is not written sequentially, and therefore must be initialized
with sufficient capacity to hold the encoding; see EncodedSize.
EncodeBuf returns the Bao encoding and root (i.e. BLAKE3 hash) for data.
EncodedSize returns the size of a Bao encoding for the provided quantity
of data.
ExtractSlice returns the slice encoding for the given offset and length. When
extracting from an outboard encoding, data should contain only the chunk
groups that will be present in the slice.
VerifyBuf verifies the Bao encoding and root (i.e. BLAKE3 hash) for data.
If the content and tree data are interleaved, outboard should be nil.
VerifyChunks verifies the provided chunks with a full outboard encoding.
VerifySlice verifies the Bao slice encoding in data, returning the
verified bytes.
![]() |
The pages are generated with Golds v0.8.2. (GOOS=linux GOARCH=amd64) Golds is a Go 101 project developed by Tapir Liu. PR and bug reports are welcome and can be submitted to the issue list. Please follow @zigo_101 (reachable from the left QR code) to get the latest news of Golds. |