Documentation ¶
Overview ¶
Copyright 2022 Molecula Corp. (DBA FeatureBase). SPDX-License-Identifier: Apache-2.0
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Blake3sum16 ¶
Blake3sum16 might be slower because we allocate a new hasher every time, but it is more conenient for writing debug code. It returns a 16 byte hash as a hexidecimal string.
func CryptoRandInt64 ¶
func CryptoRandInt64() int64
CryptoRandInt64 uses crypto/rand to get an random int64
Types ¶
type Blake3Hasher ¶
type Blake3Hasher struct {
// contains filtered or unexported fields
}
Blake3Hasher is a thread/goroutine safe way to obtain a blake3 cryptographic hash of input []byte. Reference https://github.com/BLAKE3-team/BLAKE3 suggests it is 6x faster than BLAKE2B. The Go github.com/zeebo/blake3 version is AVX2 and SSE4.1 accelerated.
func NewBlake3Hasher ¶
func NewBlake3Hasher() *Blake3Hasher
NewBlake3Hasher returns a new Blake3Hasher.
func (*Blake3Hasher) CryptoHash ¶
func (w *Blake3Hasher) CryptoHash(input []byte, buffer []byte) (outputCryptohash []byte)
CryptoHash writes the blake3 cryptographic hash of input into buffer and returns it. Like the standard libary's hash.Hash interface's Sum() method, the buffer is re-used and overwritten to avoid allocation. The caller determines the byte length of the outputCryptohash by the size of the supplied buffer slice, and this will be exactly equal to the supplies bytes. In this way, shorter or longer hashes can be provided as needed.