The Go Programming Language

Package blowfish

import "crypto/blowfish"

Package blowfish implements Bruce Schneier's Blowfish encryption algorithm.

Package files

block.go cipher.go const.go

Constants

The Blowfish block size in bytes.

const BlockSize = 8

type Cipher

A Cipher is an instance of Blowfish encryption using a particular key.

type Cipher struct {
    // contains filtered or unexported fields
}

func NewCipher

func NewCipher(key []byte) (*Cipher, os.Error)

NewCipher creates and returns a Cipher. The key argument should be the Blowfish key, 4 to 56 bytes.

func (*Cipher) BlockSize

func (c *Cipher) BlockSize() int

BlockSize returns the Blowfish block size, 8 bytes. It is necessary to satisfy the Cipher interface in the package "crypto/cipher".

func (*Cipher) Decrypt

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

Decrypt decrypts the 8-byte buffer src using the key k and stores the result in dst.

func (*Cipher) Encrypt

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

Encrypt encrypts the 8-byte buffer src using the key k and stores the result in dst. 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).

func (*Cipher) Reset

func (c *Cipher) Reset()

Reset zeros the key data, so that it will no longer appear in the process's memory.

type KeySizeError

type KeySizeError int

func (KeySizeError) String

func (k KeySizeError) String() string

release.r60.3. Except as noted, this content is licensed under a Creative Commons Attribution 3.0 License.