Documentation ¶
Index ¶
Constants ¶
View Source
const ( // Lengths of hash outputs in bytes HashLenSha2_256 = 32 HashLenSha2_384 = 48 HashLenSha3_256 = 32 HashLenSha3_384 = 48 // KMAC // the parameter maximum bytes-length as defined in NIST SP 800-185 KmacMaxParamsLen = 2040 / 8 )
Variables ¶
This section is empty.
Functions ¶
func HashesToBytes ¶
HashesToBytes converts a slice of hashes to a slice of byte slices.
Types ¶
type Hash ¶
type Hash []byte
Hash is the hash algorithms output types
func BytesToHash ¶
type Hasher ¶
type Hasher interface { // Algorithm returns the hashing algorithm for this hasher. Algorithm() HashingAlgorithm // Size returns the hash output length Size() int // ComputeHash returns the hash output regardless of the hash state ComputeHash([]byte) Hash // Write([]bytes) (using the io.Writer interface) adds more bytes to the // current hash state io.Writer // SumHash returns the hash output and resets the hash state SumHash() Hash // Reset resets the hash state Reset() }
Hasher interface
func NewKMAC_128 ¶
NewKMAC_128 returns a new KMAC instance
- key is the KMAC key (the key length is not compared to the security level, if the parameter is used as a security key and not a domain tag, the caller must make sure the key length is larger than the security level)
- customizer is the customization string. It can be left empty if no customizer is required.
type HashingAlgorithm ¶
type HashingAlgorithm int
HashingAlgorithm is an identifier for a hashing algorithm.
const ( // Supported hashing algorithms UnknownHashingAlgorithm HashingAlgorithm = iota SHA2_256 SHA2_384 SHA3_256 SHA3_384 KMAC128 )
func (HashingAlgorithm) String ¶
func (f HashingAlgorithm) String() string
String returns the string representation of this hashing algorithm.
Click to show internal directories.
Click to hide internal directories.