package blake2s
Import Path
golang.org/x/crypto/blake2s (on go.dev)
Dependency Relation
imports 7 packages, and imported by 2 packages
Involved Source Files
Package blake2s implements the BLAKE2s hash algorithm defined by RFC 7693
and the extendable output function (XOF) BLAKE2Xs.
BLAKE2s is optimized for 8- to 32-bit platforms and produces digests of any
size between 1 and 32 bytes.
For a detailed specification of BLAKE2s see https://blake2.net/blake2.pdf
and for BLAKE2Xs see https://blake2.net/blake2x.pdf
If you aren't sure which function you need, use BLAKE2s (Sum256 or New256).
If you need a secret-key MAC (message authentication code), use the New256
function with a non-nil key.
BLAKE2X is a construction to compute hash values larger than 32 bytes. It
can produce hash values between 0 and 65535 bytes.
blake2s_amd64.go
blake2s_generic.go
blake2x.go
blake2s_amd64.s
Package-Level Type Names (only one)
XOF defines the interface to hash functions that
support arbitrary-length output.
Clone returns a copy of the XOF in its current state.
( XOF) Read(p []byte) (n int, err error)
Reset resets the XOF to its initial state.
( XOF) Write([]byte) (int, error)
XOF : github.com/miekg/dns.Writer
XOF : internal/bisect.Writer
XOF : io.Reader
XOF : io.ReadWriter
XOF : io.Writer
func NewXOF(size uint16, key []byte) (XOF, error)
func XOF.Clone() XOF
Package-Level Functions (total 4)
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.
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.
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.
Sum256 returns the BLAKE2s-256 checksum of the data.
Package-Level Constants (total 4)
The blocksize of BLAKE2s in bytes.
OutputLengthUnknown can be used as the size argument to NewXOF to indicate
the length of the output is not known in advance.
The hash size of BLAKE2s-256 in bytes.
The hash size of BLAKE2s-128 in 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. |