blowfish

package
v0.0.25 Latest Latest
Warning

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

Go to latest
Published: Aug 22, 2026 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

View Source
const BlockSize = 8

BlockSize is the Blowfish block size in bytes (8 bytes).

View Source
const ErrKeySize = "blowfish: invalid key size"

ErrKeySize is the error returned when the key has an invalid size.

Variables

This section is empty.

Functions

func ExpandKey

func ExpandKey(key []byte, c *Cipher)

ExpandKey performs the key expansion on the given Cipher.

Types

type Cipher

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

Cipher is an instance of the Blowfish cipher.

func NewCipher

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

NewCipher creates and returns a Cipher. The key must be between 1 and 56 bytes long.

func NewSaltedCipher

func NewSaltedCipher(key, salt []byte) (*Cipher, error)

NewSaltedCipher creates and returns a Cipher that folds a salt into its key schedule. For bcrypt compatibility, the key may exceed 56 bytes.

func (*Cipher) Decrypt

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

Decrypt decrypts the 8-byte block src and stores the result in dst.

func (*Cipher) Encrypt

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

Encrypt encrypts the 8-byte block src and stores the result in dst.

Jump to

Keyboard shortcuts

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