Documentation
¶
Overview ¶
Package blake3 provides an SSE4.1/AVX2 accelerated BLAKE3 implementation.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DeriveKey ¶
DeriveKey derives a key based on reusable key material of any length, in the given context. The key will be stored in out, using all of its current length.
Context strings must be hardcoded constants, and the recommended format is "[application] [commit timestamp] [purpose]", e.g., "example.com 2019-12-25 16:18:03 session tokens v1".
Types ¶
type Digest ¶
type Digest struct {
// contains filtered or unexported fields
}
Digest captures the state of a Hasher allowing reading and seeking through the output stream.
type Hasher ¶
type Hasher struct {
// contains filtered or unexported fields
}
Hasher is a hash.Hash for BLAKE3.
func New ¶
func New() *Hasher
New returns a new Hasher that has a digest size of 32 bytes.
If you need more or less output bytes than that, use Digest method.
func New512 ¶
func New512() *Hasher
New512 returns a new Hasher that has a digest size of 64 byties.
func NewDeriveKey ¶
NewDeriveKey returns a Hasher that is initialized with the context string. See DeriveKey for details. It has a digest size of 32 bytes.
If you need more or less output bytes than that, use the Digest method.
func NewKeyed ¶
NewKeyed returns a new Hasher that uses the 32 byte input key and has a digest size of 32 bytes.
If you need more or less output bytes than that, use the Digest method.
func (*Hasher) BlockSize ¶
BlockSize implements part of the hash.Hash interface. It returns the most natural size to write to the Hasher.
func (*Hasher) Clone ¶
Clone returns a new Hasher with the same internal state.
Modifying the resulting Hasher will not modify the original Hasher, and vice versa.
func (*Hasher) Digest ¶
Digest takes a snapshot of the hash state and returns an object that can be used to read and seek through 2^64 bytes of digest output.
func (*Hasher) Reset ¶
func (h *Hasher) Reset()
Reset implements part of the hash.Hash interface. It causes the Hasher to act as if it was newly created.
func (*Hasher) Size ¶
Size implements part of the hash.Hash interface. It returns the number of bytes the hash will output in Sum.
func (*Hasher) Sum ¶
Sum implements part of the hash.Hash interface. It appends the digest of the Hasher to the provided buffer and returns it.