Documentation ¶
Overview ¶
Package blowfish implements Bruce Schneier's Blowfish encryption algorithm.
Index ¶
Constants ¶
const BlockSize = 8
The Blowfish block size in bytes.
Variables ¶
This section is empty.
Functions ¶
func ExpandKey ¶
ExpandKey performs a key expansion on the given *Cipher. Specifically, it performs the Blowfish algorithm's key schedule which sets up the *Cipher's pi and substitution tables for calls to Encrypt. This is used, primarily, by the bcrypt package to reuse the Blowfish key schedule during its set up. It's unlikely that you need to use this directly.
Types ¶
type Cipher ¶
type Cipher struct {
// contains filtered or unexported fields
}
A Cipher is an instance of Blowfish encryption using a particular key.
func NewCipher ¶
NewCipher creates and returns a Cipher. The key argument should be the Blowfish key, 4 to 56 bytes.
func NewSaltedCipher ¶
NewSaltedCipher creates a returns a Cipher that folds a salt into its key schedule. For most purposes, NewCipher, instead of NewSaltedCipher, is sufficient and desirable. For bcrypt compatiblity, the key can be over 56 bytes.
func (*Cipher) BlockSize ¶
BlockSize returns the Blowfish block size, 8 bytes. It is necessary to satisfy the Block interface in the package "crypto/cipher".
func (*Cipher) Decrypt ¶
Decrypt decrypts the 8-byte buffer src using the key k and stores the result in dst.
type KeySizeError ¶
type KeySizeError int
func (KeySizeError) Error ¶
func (k KeySizeError) Error() string