Documentation ¶
Overview ¶
Package skein implements the Skein512 hash function based on the Threefish tweakable block cipher.
Overview ¶
Skein is a hash function family using the tweakable block cipher Threefish in Unique Block Iteration (UBI) chaining mode while leveraging an optional low-overhead argument-system for flexibility. There are three versions of Skein, each of them using the corresponding Threefish version:
- Skein256 using Threefish256 and processes 256 bit blocks
- Skein512 using Threefish512 and processes 512 bit blocks
- Skein1024 using Threefish1024 and processes 1024 bit blocks
Skein can be used as hash function, MAC or KDF and supports personalized, randomized (salted) and public-key-bound hashing. Furthermore Skein has some additional features (currently) not implemented here. For details see http://www.skein-hash.info/ Skein was submitted to the SHA-3 challenge.
Skein can produce hash values of any size (up to (2^64 -1) x BlockSize bytes) not only the common sizes 160, 224, 256, 384 and 512 bit.
Security and Recommendations ¶
All Skein varaiants (as far as known) secure. The Skein authors recommend to use Skein512 for most applications. Skein256 should be used for small devices like smartcards. Skein1024 is the ultra-conservative variant providing a level of security (mostly) not needed.
Index ¶
- Constants
- func New(hashsize int, conf *Config) hash.Hash
- func New256(key []byte) hash.Hash
- func New512(key []byte) hash.Hash
- func Sum(msg []byte, hashsize int, conf *Config) []byte
- func Sum160(out *[20]byte, msg, key []byte)
- func Sum256(out *[32]byte, msg, key []byte)
- func Sum384(out *[48]byte, msg, key []byte)
- func Sum512(out *[64]byte, msg, key []byte)
- type Config
Constants ¶
const ( // CfgKey is the config type for the Key. CfgKey uint64 = 0 // CfgConfig is the config type for the configuration. CfgConfig uint64 = 4 // CfgPersonal is the config type for the personalization. CfgPersonal uint64 = 8 // CfgPublicKey is the config type for the public key. CfgPublicKey uint64 = 12 // CfgKeyID is the config type for the key id. CfgKeyID uint64 = 16 // CfgNonce is the config type for the nonce. CfgNonce uint64 = 20 // CfgMessage is the config type for the message. CfgMessage uint64 = 48 // CfgOutput is the config type for the output. CfgOutput uint64 = 63 // FirstBlock is the first block flag FirstBlock uint64 = 1 << 62 // FinalBlock is the final block flag FinalBlock uint64 = 1 << 63 // The skein schema ID = S H A 3 1 0 0 0 SchemaID uint64 = 0x133414853 )
The different parameter types
const ( // The blocksize of Skein-512 in bytes. BlockSize = threefish.BlockSize512 )
Variables ¶
This section is empty.
Functions ¶
func New ¶
New returns a hash.Hash computing the Skein512 checksum with the given hash size. The conf is optional and configurates the hash.Hash
func New256 ¶
New256 returns a hash.Hash computing the Skein512 256 bit checksum. The key is optional and turns the hash into a MAC.
func New512 ¶
New512 returns a hash.Hash computing the Skein512 512 bit checksum. The key is optional and turns the hash into a MAC.
func Sum ¶
Sum returns the Skein512 checksum with the given hash size of msg using the (optional) conf for configuration. The hashsize must be > 0.
func Sum160 ¶
Sum160 computes the 160 bit Skein512 checksum (or MAC if key is set) of msg and writes it to out. The key is optional and can be nil.
func Sum256 ¶
Sum256 computes the 256 bit Skein512 checksum (or MAC if key is set) of msg and writes it to out. The key is optional and can be nil.
Types ¶
type Config ¶
type Config struct { Key []byte // Optional: The secret key for MAC Personal []byte // Optional: The personalization for unique hashing PublicKey []byte // Optional: The public key for public-key bound hashing KeyID []byte // Optional: The key id for key derivation Nonce []byte // Optional: The nonce for randomized hashing }
Config contains the Skein configuration: - Key for computing MACs - Personal for personalized hashing - PublicKey for public-key-bound hashing - KeyID for key derivation - Nonce for randomized hashing All fields are optional and can be nil.
Directories ¶
Path | Synopsis |
---|---|
Package skein1024 implements the Skein1024 hash function based on the Threefish1024 tweakable block cipher.
|
Package skein1024 implements the Skein1024 hash function based on the Threefish1024 tweakable block cipher. |
Package skein256 implements the Skein256 hash function based on the Threefish256 tweakable block cipher.
|
Package skein256 implements the Skein256 hash function based on the Threefish256 tweakable block cipher. |
Package threefish implements the Threefish tweakable block cipher.
|
Package threefish implements the Threefish tweakable block cipher. |