Documentation
¶
Overview ¶
This package implements the Threefish cipher as specified in the Skein V1.3 specification. The Skein digest algorithm uses Threefish to generate the digests.
NOTE: Threefish is a new cipher algorithm - use with care until fully analysed.
Copyright (C) 2011 Werner Dittmann ¶
This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.
Authors: Werner Dittmann <Werner.Dittmann@t-online.de>
Copyright (C) 2011 Werner Dittmann ¶
This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.
Authors: Werner Dittmann <Werner.Dittmann@t-online.de>
Copyright (C) 2011 Werner Dittmann ¶
This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.
Authors: Werner Dittmann <Werner.Dittmann@t-online.de>
Index ¶
Constants ¶
const ( KEY_SCHEDULE_CONST = uint64(0x1BD11BDAA9FC1A22) EXPANDED_TWEAK_SIZE = 3 )
General Threefish constants
const ( CIPHER_SIZE_1024 = 1024 CIPHER_QWORDS_1024 = CIPHER_SIZE_1024 / 64 EXPANDED_KEY_SIZE_1024 = CIPHER_QWORDS_1024 + 1 )
Constants for Threefish 1024 implementation
const ( CIPHER_SIZE_256 = 256 CIPHER_QWORDS_256 = CIPHER_SIZE_256 / 64 EXPANDED_KEY_SIZE_256 = CIPHER_QWORDS_256 + 1 )
Constants for Threefish 256 implementation
const ( CIPHER_SIZE_512 = 512 CIPHER_QWORDS_512 = CIPHER_SIZE_512 / 64 EXPANDED_KEY_SIZE_512 = CIPHER_QWORDS_512 + 1 )
Constants for Threefish 512 implementation
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Cipher ¶
type Cipher struct {
// contains filtered or unexported fields
}
A Cipher is an instance of Threefish using a particular key and state size.
func New ¶
NewCipher creates and returns a Cipher.
The key length can be 32, 64 or 128 bytes and must match the Threefish state size. The blocksize is the same as the key length (state size). The tweak is a uint64 array with two elements.
key
Key data, key length selects the internal state size
tweak
The initial Tweak data for this threefish instance
func New64 ¶
New64 creates and returns a Cipher.
The key is a uint64 array of 4, 8 or 16 elements. The key length must match the Threefish state size. The blocksize is the same as the key length (state size). The tweak is a uint64 array with two elements.
key
Key data, key length selects the internal state size
tweak
The initial Tweak data for this threefish instance
func NewSize ¶
NewSize creates and returns a Cipher.
The size argument is the requested Threefish state size which is also the key and block size. Supported sizes see constants section.
func (*Cipher) Decrypt ¶
Decrypt a block. Dst and src may point at the same memory.
dst
Destination of encypted data (cipher data)
src
Contains a block of plain data
func (*Cipher) Decrypt64 ¶
Decrypt a block. Blocks are unit64 arrays. Dst and src may point at the same memory.
dst
Destination of decrypted data (plain data)
src
Contains a block of encrypted data (cipher data)
func (*Cipher) Encrypt ¶
Encrypt a block. Dst and src may point at the same memory.
dst
Destination of encypted data (cipher data)
src
Contains a block of plain data
func (*Cipher) Encrypt64 ¶
Encrypt a block. Blocks are unit64 arrays. Dst and src may point at the same memory.
dst
Destination of encypted data (cipher data)
src
Contains a block of plain data
type KeySizeError ¶
type KeySizeError int
func (KeySizeError) Error ¶
func (k KeySizeError) Error() string