turing

package module
v1.0.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 4, 2016 License: MIT Imports: 1 Imported by: 2

README

Build Status Coverage Report Card GoDoc

Turing

Overview

A pure go implementation of the Turing stream cipher, as detailed in "Turing: a Fast Stream Cipher" by Gregory G. Rose and Philip Hawkes. Please don't use this cipher if your goal is to implement strong encryption. This package was written to interoperate with legacy applications.

API Promise

The API is stable. Changes are guaranteed to remain backwards-compatible.

Usage

Please see the godocs for usage details.

Authors

Bob Ziuchkovski (@bobziuchkovski)

License (MIT)

Copyright (c) 2016 Bob Ziuchkovski

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

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

View Source
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

func NewCipher(key []byte, iv []byte) (cipher *Cipher, err error)

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

func (cipher *Cipher) XORKeyStream(dst, src []byte)

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

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL