Documentation
¶
Index ¶
- Constants
- func NewBLAKE3() stdhash.Hash
- func NewBLAKE3Keyed(key []byte) (stdhash.Hash, error)
- func NewBlake2b(size int, key []byte) (stdhash.Hash, error)
- func NewBlake2bXOF(length uint32, key []byte) (xof.XOF, error)
- func NewBlake2s(size int, key []byte) (stdhash.Hash, error)
- func NewBlake2sXOF(length uint32, key []byte) (xof.XOF, error)deprecated
- func NewSHA224() stdhash.Hash
- func NewSHA256() stdhash.Hash
- func NewSHA3224() stdhash.Hash
- func NewSHA3256() stdhash.Hash
- func NewSHA3384() stdhash.Hash
- func NewSHA3512() stdhash.Hash
- func NewSHA384() stdhash.Hash
- func NewSHA512() stdhash.Hash
- func NewXoodyak() stdhash.Hash
- func ParallelHash128(msg []byte, blockSize int, outLen int, customization []byte) ([]byte, error)
- func ParallelHash256(msg []byte, blockSize int, outLen int, customization []byte) ([]byte, error)
- func Sum224(data []byte) [sha3Size224]byte
- func Sum256(data []byte) [sha3Size256]byte
- func Sum384(data []byte) [sha3Size384]byte
- func Sum512(data []byte) [sha3Size512]byte
- func SumBLAKE3(msg []byte) []byte
- func SumSHA224(data []byte) [sha2Size224]byte
- func SumSHA256(data []byte) [sha2Size256]byte
- func SumSHA384(data []byte) [sha2Size384]byte
- func SumSHA512(data []byte) [sha2Size512]byte
- func SumXoodyak(msg []byte) [DigestSize]byte
- func TupleHash128(tuple [][]byte, outLen int, customization []byte) ([]byte, error)
- func TupleHash256(tuple [][]byte, outLen int, customization []byte) ([]byte, error)
- type Blake2bBuilder
- func (b Blake2bBuilder) Hash() (stdhash.Hash, error)
- func (b Blake2bBuilder) Hasher() (Hasher, error)
- func (b Blake2bBuilder) Key(key []byte) Blake2bBuilder
- func (b Blake2bBuilder) Size(size int) Blake2bBuilder
- func (b Blake2bBuilder) Sum(msg []byte) ([]byte, error)
- func (b Blake2bBuilder) XOF(length uint32) (xof.XOF, error)
- type Blake2sBuilder
- func (b Blake2sBuilder) Hash() (stdhash.Hash, error)
- func (b Blake2sBuilder) Hasher() (Hasher, error)
- func (b Blake2sBuilder) Key(key []byte) Blake2sBuilder
- func (b Blake2sBuilder) Size(size int) Blake2sBuilder
- func (b Blake2sBuilder) Sum(msg []byte) ([]byte, error)
- func (b Blake2sBuilder) XOF(length uint32) (xof.XOF, error)
- type Hash
- type Hasher
- func NewBLAKE3Hasher() Hasher
- func NewBLAKE3KeyedHasher(key []byte) (Hasher, error)
- func NewBlake2bHasher(size int, key []byte) (Hasher, error)
- func NewBlake2sHasher(size int, key []byte) (Hasher, error)
- func NewSHA224Hasher() Hasher
- func NewSHA256Hasher() Hasher
- func NewSHA3224Hasher() Hasher
- func NewSHA3256Hasher() Hasher
- func NewSHA3384Hasher() Hasher
- func NewSHA3512Hasher() Hasher
- func NewSHA384Hasher() Hasher
- func NewSHA512Hasher() Hasher
- func NewXoodyakHasher() Hasher
Constants ¶
const Blake2bXOFUnknown = xof.Blake2bUnknown
Blake2bXOFUnknown indicates that the output length of a BLAKE2b XOF is unspecified in advance.
const Blake2sXOFUnknown = xof.Blake2sUnknown
Blake2sXOFUnknown indicates that the output length of a BLAKE2s XOF is unspecified in advance.
const DigestSize = 32
Variables ¶
This section is empty.
Functions ¶
func NewBLAKE3Keyed ¶
NewBLAKE3Keyed returns a keyed BLAKE3 hash.Hash. The key must be exactly 32 bytes.
func NewBlake2b ¶
NewBlake2b returns a streaming BLAKE2b hash.Hash with the specified digest length and key.
func NewBlake2bXOF ¶
NewBlake2bXOF constructs a BLAKE2b extendable-output instance. Deprecated: use xof.Blake2b.
func NewBlake2s ¶
NewBlake2s returns a streaming BLAKE2s hash.Hash with the specified digest length and key.
func NewSHA3224 ¶
NewSHA3224 returns a hash computing the SHA3-224 digest.
func NewSHA3256 ¶
NewSHA3256 returns a hash computing the SHA3-256 digest.
func NewSHA3384 ¶
NewSHA3384 returns a hash computing the SHA3-384 digest.
func NewSHA3512 ¶
NewSHA3512 returns a hash computing the SHA3-512 digest.
func NewXoodyak ¶
NewXoodyak returns a hash.Hash computing the 32-byte Xoodyak digest.
func ParallelHash128 ¶
ParallelHash128 computes ParallelHash-128 over msg using the specified block size and produces outLen bytes of output. The customization string may be nil.
func ParallelHash256 ¶
ParallelHash256 computes ParallelHash-256 over msg using the provided block size and returns outLen bytes of output.
func SumXoodyak ¶
func SumXoodyak(msg []byte) [DigestSize]byte
SumXoodyak returns the Xoodyak hash of msg.
func TupleHash128 ¶
TupleHash128 returns the TupleHash-128 digest of the provided tuple, producing outLen bytes of output. The optional customization string may be nil.
Types ¶
type Blake2bBuilder ¶
type Blake2bBuilder struct {
// contains filtered or unexported fields
}
Blake2bBuilder constructs keyed or unkeyed BLAKE2b hash and XOF instances.
func NewBlake2bBuilder ¶
func NewBlake2bBuilder() Blake2bBuilder
NewBlake2bBuilder returns a builder configured for the default 64-byte BLAKE2b digest without a key.
func (Blake2bBuilder) Hash ¶
func (b Blake2bBuilder) Hash() (stdhash.Hash, error)
Hash returns a stateful hash.Hash instance implementing the configured BLAKE2b variant.
func (Blake2bBuilder) Hasher ¶
func (b Blake2bBuilder) Hasher() (Hasher, error)
Hasher returns a stateless helper implementing hash.Hasher.
func (Blake2bBuilder) Key ¶
func (b Blake2bBuilder) Key(key []byte) Blake2bBuilder
Key configures the secret key used for MAC mode. The key is copied so that subsequent modifications by the caller do not affect the builder.
func (Blake2bBuilder) Size ¶
func (b Blake2bBuilder) Size(size int) Blake2bBuilder
Size sets the desired digest length. The value must be between 1 and 64.
type Blake2sBuilder ¶
type Blake2sBuilder struct {
// contains filtered or unexported fields
}
Blake2sBuilder constructs keyed or unkeyed BLAKE2s hash and XOF instances.
func NewBlake2sBuilder ¶
func NewBlake2sBuilder() Blake2sBuilder
NewBlake2sBuilder returns a builder configured for the default 32-byte BLAKE2s digest without a key.
func (Blake2sBuilder) Hash ¶
func (b Blake2sBuilder) Hash() (stdhash.Hash, error)
Hash returns a stateful hash.Hash instance implementing the configured BLAKE2s variant.
func (Blake2sBuilder) Hasher ¶
func (b Blake2sBuilder) Hasher() (Hasher, error)
Hasher returns a stateless helper implementing hash.Hasher.
func (Blake2sBuilder) Key ¶
func (b Blake2sBuilder) Key(key []byte) Blake2sBuilder
Key configures the secret key used for MAC mode. The key is copied so that subsequent modifications by the caller do not affect the builder.
func (Blake2sBuilder) Size ¶
func (b Blake2sBuilder) Size(size int) Blake2sBuilder
Size sets the desired digest length. The value must be between 1 and 32.
type Hash ¶
type Hash struct {
// contains filtered or unexported fields
}
Hash implements the Xoodyak hash function (32-byte digest) using the Cyclist hash mode.
type Hasher ¶
Hasher defines the minimal single-shot hashing API exposed by the library.
It mirrors the simple AEAD interface in the aead package by offering a uniform helper for computing fixed-length digests without having to use the streaming hash.Hash interface from the standard library. Implementations are expected to be stateless and may be backed by any of the concrete hash primitives exposed under hash/.
Hash computes the digest of msg and returns the resulting bytes. Size reports the digest length in bytes.
func NewBLAKE3Hasher ¶
func NewBLAKE3Hasher() Hasher
NewBLAKE3Hasher returns a stateless helper implementing hash.Hasher.
func NewBLAKE3KeyedHasher ¶
NewBLAKE3KeyedHasher returns a keyed helper implementing hash.Hasher.
func NewBlake2bHasher ¶
NewBlake2bHasher creates a stateless BLAKE2b helper with the given digest length and optional key.
func NewBlake2sHasher ¶
NewBlake2sHasher creates a stateless BLAKE2s helper with the given digest length and optional key.
func NewSHA224Hasher ¶ added in v1.0.1
func NewSHA224Hasher() Hasher
NewSHA224Hasher returns a stateless SHA-224 helper implementing hash.Hasher.
func NewSHA256Hasher ¶ added in v1.0.1
func NewSHA256Hasher() Hasher
NewSHA256Hasher returns a stateless SHA-256 helper implementing hash.Hasher.
func NewSHA3224Hasher ¶
func NewSHA3224Hasher() Hasher
NewSHA3224Hasher returns a stateless SHA3-224 helper implementing hash.Hasher.
func NewSHA3256Hasher ¶
func NewSHA3256Hasher() Hasher
NewSHA3256Hasher returns a stateless SHA3-256 helper implementing hash.Hasher.
func NewSHA3384Hasher ¶
func NewSHA3384Hasher() Hasher
NewSHA3384Hasher returns a stateless SHA3-384 helper implementing hash.Hasher.
func NewSHA3512Hasher ¶
func NewSHA3512Hasher() Hasher
NewSHA3512Hasher returns a stateless SHA3-512 helper implementing hash.Hasher.
func NewSHA384Hasher ¶ added in v1.0.1
func NewSHA384Hasher() Hasher
NewSHA384Hasher returns a stateless SHA-384 helper implementing hash.Hasher.
func NewSHA512Hasher ¶ added in v1.0.1
func NewSHA512Hasher() Hasher
NewSHA512Hasher returns a stateless SHA-512 helper implementing hash.Hasher.
func NewXoodyakHasher ¶
func NewXoodyakHasher() Hasher
NewXoodyakHasher returns a stateless helper implementing hash.Hasher for Xoodyak.