Documentation ¶
Overview ¶
Package turing implements the Turing stream cipher, as defined in Gregory G. Rose and Philip Hawkes "Turing: a Fast Stream Cipher". The package API mimics that of the crypto/rc4 package.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var Version = struct { Major int Minor int Patch int }{1, 0, 2}
Version records the version of the turing package
Functions ¶
This section is empty.
Types ¶
type Cipher ¶
type Cipher struct {
// contains filtered or unexported fields
}
Cipher is an instance of the Turing cipher using a particular key/IV pair
func NewCipher ¶
NewCipher creates and returns a new Cipher. The key size must be a multiple of 4 bytes and must be between 8 and 32 bytes. The IV is optional and may be omitted by specifying a nil value. If the IV is present, the size must be a multiple of 4 bytes. The combined size of the key and IV must not exceed 48 bytes. These restrictions are part of the algorithm specs.
func (*Cipher) Reset ¶
func (cipher *Cipher) Reset()
Reset makes a best effort attempt to remove the key data from memory. However, go's garbage-collecting semantics make it impossible to provide an absolute guarantee that the key data is completely unreachable.
func (*Cipher) XORKeyStream ¶
XORKeyStream sets dst to the result of XORing src with the key stream. Dst and src may be the same slice but otherwise should not overlap.
type KeySizeError ¶
type KeySizeError string
KeySizeError is used to indicate problems with provided key/IV values. See the NewCipher for key/IV requirements.
func (KeySizeError) Error ¶
func (k KeySizeError) Error() string