Standard library
Hash
SipHash, SHA-256, and SHA-512.
Introduction
SipHash, SHA-256, and SHA-512. Import std/crypto/hash to bind the module as hash. Call free functions as hash.name(...). Struct methods use a receiver value.
/ std/crypto/hash
This page is the package reference for std/crypto/hash. Private helpers used only by co-located tests are not listed.
Functions
Free functions on hash. Each function has a short description, an example, then parameters and return shape.
sha256
Computes the SHA-256 digest of data. Call form: hash.sha256(data).
/ std/crypto/hash
$ dig = hash.sha256(b"abc")
Parameters: data: bytes or string input. Returns: 32-byte digest.
sha512
Computes the SHA-512 digest of data. Call form: hash.sha512(data).
/ std/crypto/hash
$ dig = hash.sha512(b"abc")
Parameters: data: bytes or string input. Returns: 64-byte digest.
sip
Computes a SipHash of data with the given key material. Call form: hash.sip(k0, k1, msg).
/ std/crypto/hash
$ dig = hash.sip(b"0123456789abcdef", b"abc")
Parameters: key: key bytes. data: bytes or string input. Returns: Hash bytes.