Documentation ¶
Overview ¶
Package threefish implements the Threefish tweakable block cipher. Threefish is designed to be the core function of the Skein hash function family. There are three versions of Threefish
- Threefish256 processes 256 bit blocks
- Threefish512 processes 512 bit blocks
- Threefish1024 processes 1024 bit blocks
Index ¶
- Constants
- func Decrypt1024(block *[16]uint64, keys *[17]uint64, tweak *[3]uint64)
- func Decrypt256(block *[4]uint64, keys *[5]uint64, tweak *[3]uint64)
- func Decrypt512(block *[8]uint64, keys *[9]uint64, tweak *[3]uint64)
- func Encrypt1024(block *[16]uint64, keys *[17]uint64, tweak *[3]uint64)
- func Encrypt256(block *[4]uint64, keys *[5]uint64, tweak *[3]uint64)
- func Encrypt512(block *[8]uint64, keys *[9]uint64, tweak *[3]uint64)
- func IncrementTweak(tweak *[3]uint64, ctr uint64)
- func NewCipher(tweak *[TweakSize]byte, key []byte) (cipher.Block, error)
- func UBI1024(block *[16]uint64, hVal *[17]uint64, tweak *[3]uint64)
- func UBI256(block *[4]uint64, hVal *[5]uint64, tweak *[3]uint64)
- func UBI512(block *[8]uint64, hVal *[9]uint64, tweak *[3]uint64)
Constants ¶
const ( // The size of the tweak in bytes. TweakSize = 16 // C240 is the key schedule constant C240 = 0x1bd11bdaa9fc1a22 // The block size of Threefish-256 in bytes. BlockSize256 = 32 // The block size of Threefish-512 in bytes. BlockSize512 = 64 // The block size of Threefish-1024 in bytes. BlockSize1024 = 128 )
Variables ¶
This section is empty.
Functions ¶
func Decrypt1024 ¶
Decrypt1024 decrypts the 16 words of block using the expanded 1024 bit key and the 128 bit tweak. The keys[16] must be keys[0] xor keys[1] xor ... keys[15] xor C240. The tweak[2] must be tweak[0] xor tweak[1].
func Decrypt256 ¶
Decrypt256 decrypts the 4 words of block using the expanded 256 bit key and the 128 bit tweak. The keys[4] must be keys[0] xor keys[1] xor ... keys[3] xor C240. The tweak[2] must be tweak[0] xor tweak[1].
func Decrypt512 ¶
Decrypt512 decrypts the 8 words of block using the expanded 512 bit key and the 128 bit tweak. The keys[8] must be keys[0] xor keys[1] xor ... keys[8] xor C240. The tweak[2] must be tweak[0] xor tweak[1].
func Encrypt1024 ¶
Encrypt1024 encrypts the 16 words of block using the expanded 1024 bit key and the 128 bit tweak. The keys[16] must be keys[0] xor keys[1] xor ... keys[15] xor C240. The tweak[2] must be tweak[0] xor tweak[1].
func Encrypt256 ¶
Encrypt256 encrypts the 4 words of block using the expanded 256 bit key and the 128 bit tweak. The keys[4] must be keys[0] xor keys[1] xor ... keys[3] xor C240. The tweak[2] must be tweak[0] xor tweak[1].
func Encrypt512 ¶
Encrypt512 encrypts the 8 words of block using the expanded 512 bit key and the 128 bit tweak. The keys[8] must be keys[0] xor keys[1] xor ... keys[8] xor C240. The tweak[2] must be tweak[0] xor tweak[1].
func IncrementTweak ¶
Increment the tweak by the ctr argument. Skein can consume messages up to 2^96 -1 bytes.
func NewCipher ¶
NewCipher returns a cipher.Block implementing the Threefish cipher. The length of the key must be 32, 64 or 128 byte. The length of the tweak must be TweakSize. The returned cipher implements:
- Threefish-256 - if len(key) = 32
- Threefish-512 - if len(key) = 64
- Threefish-1024 - if len(key) = 128
func UBI1024 ¶
UBI1024 does a Threefish1024 encryption of the given block using the chain values hVal and the tweak. The chain values are updated through hVal[i] = block[i] ^ Enc(block)[i]
Types ¶
This section is empty.