Documentation
¶
Overview ¶
Package skein implements the Skein-512 hash function, MAC, and stream cipher as defined in "The Skein Hash Function Family, v1.3".
Index ¶
Constants ¶
const BlockSize = 64
BlockSize is the block size of Skein-512 in bytes.
Variables ¶
This section is empty.
Functions ¶
func NewHash ¶
NewHash returns hash.Hash calculating checksum of the given length in bytes (for example, to calculate 256-bit hash, outLen must be set to 32).
Types ¶
type Args ¶
type Args struct {
// Key is a secret key for MAC, KDF, or stream cipher
Key []byte
// Person is a personalization string
Person []byte
// PublicKey is a public key for signature hashing
PublicKey []byte
// KeyId is a key identifier for KDF
KeyId []byte
// Nonce for stream cipher or randomized hashing
Nonce []byte
// NoMsg indicates whether message input is used by the function.
//
// If false (default), message input it used, and thus if zero-length
// message is supplied to Write or if Write was not called, it will be
// assumed that the message input is zero-length, and thus will be
// processed as such (padded with zeroes). This is the normal way Skein
// hash and MAC are used.
//
// If true, message input is not used, so any call to Write will
// return an error. This is useful for constructions such as a
// that skip message input, such as a stream cipher.
//
// The name is negative to preserve backward compatibility.
NoMsg bool
}
Args can be used to configure hash function for different purposes. All fields are optional: if a field is nil, it will not be used.
type Hash ¶
type Hash struct {
// contains filtered or unexported fields
}
Hash represents a state of Skein hash function. It implements hash.Hash interface.
func New ¶
New returns a new skein.Hash configured with the given arguments. The final output length of hash function in bytes is outLen (for example, 64 when calculating 512-bit hash). Configuration arguments may be nil.
func (*Hash) OutputReader ¶
OutputReader returns an io.Reader that can be used to read arbitrary-length output of the hash. Reading from it doesn't change the underlying hash state.
func (*Hash) Reset ¶
func (h *Hash) Reset()
Reset resets hash to its state after initialization. If hash was initialized with arguments, such as key, these arguments are preserved.
func (*Hash) Size ¶
Size returns the number of bytes Sum will return. If the hash was created with output size greater than the maximum size of int, the result is undefined.