const ( // The blocksize of BLAKE2s in bytes. BlockSize = 64 // The hash size of BLAKE2s-256 in bytes. Size = 32 // The hash size of BLAKE2s-128 in bytes. Size128 = 16 )
OutputLengthUnknown can be used as the size argument to NewXOF to indicate the length of the output is not known in advance.
const OutputLengthUnknown = 0
func New128(key []byte) (hash.Hash, error)
New128 returns a new hash.Hash computing the BLAKE2s-128 checksum given a non-empty key. Note that a 128-bit digest is too small to be secure as a cryptographic hash and should only be used as a MAC, thus the key argument is not optional.
func New256(key []byte) (hash.Hash, error)
New256 returns a new hash.Hash computing the BLAKE2s-256 checksum. A non-nil key turns the hash into a MAC. The key must between zero and 32 bytes long. When the key is nil, the returned hash.Hash implements BinaryMarshaler and BinaryUnmarshaler for state (de)serialization as documented by hash.Hash.
func Sum256(data []byte) [Size]byte
Sum256 returns the BLAKE2s-256 checksum of the data.
XOF defines the interface to hash functions that support arbitrary-length output.
type XOF interface { // Write absorbs more data into the hash's state. It panics if called // after Read. io.Writer // Read reads more output from the hash. It returns io.EOF if the limit // has been reached. io.Reader // Clone returns a copy of the XOF in its current state. Clone() XOF // Reset resets the XOF to its initial state. Reset() }
func NewXOF(size uint16, key []byte) (XOF, error)
NewXOF creates a new variable-output-length hash. The hash either produce a known number of bytes (1 <= size < 65535), or an unknown number of bytes (size == OutputLengthUnknown). In the latter case, an absolute limit of 128GiB applies.
A non-nil key turns the hash into a MAC. The key must between zero and 32 bytes long.