twofish

package
v1.8.0 Latest Latest
Warning

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

Go to latest
Published: Sep 21, 2018 License: Apache-2.0, BSD-3-Clause Imports: 1 Imported by: 0

Documentation

Overview

Package twofish implements Bruce Schneier's Twofish encryption algorithm.

Index

Constants

View Source
const BlockSize = 16

BlockSize is the constant block size of Twofish.

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 Twofish encryption using a particular key.

func NewCipher

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

NewCipher creates and returns a Cipher. The key argument should be the Twofish key, 16, 24 or 32 bytes.

func (*Cipher) BlockSize

func (c *Cipher) BlockSize() int

BlockSize returns the Twofish block size, 16 bytes.

func (*Cipher) Decrypt

func (c *Cipher) Decrypt(dst, src []byte)

Decrypt decrypts a 16-byte block from src to dst, which may overlap.

func (*Cipher) Encrypt

func (c *Cipher) Encrypt(dst, src []byte)

Encrypt encrypts a 16-byte block from src to dst, which may overlap. Note that for amounts of data larger than a block, it is not safe to just call Encrypt on successive blocks; instead, use an encryption mode like CBC (see crypto/cipher/cbc.go).

type KeySizeError

type KeySizeError int

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