crypto::blowfish+x86_64 +linux

The crypto::blowfish module provides an implementation of Bruce Schneier's Blowfish encryption standard via the crypto::cipher::block interface. The use of this algorithm is not recommended except for legacy use-cases; prefer crypto::aes:: when possible.

When combined with a block cipher mode from crypto::cipher::, suitable buffer lengths for static allocation are provided as constants such as BLOCKSZ.

This is a low-level module which implements cryptographic primitives. Direct use of cryptographic primitives is not recommended for non-experts, as incorrect use of these primitives can easily lead to the introduction of security vulnerabilities. Non-experts are advised to use the high-level operations available in the top-level crypto:: module.

Be advised that Hare's cryptography implementations have not been audited.

Index

Types

// Undocumented types:
type state = struct {
	block: cipher::block,
	p: [18]u32,
	s0: [256]u32,
	s1: [256]u32,
	s2: [256]u32,
	s3: [256]u32,
};

Constants

def BLOCKSZ: size = 8;

Functions

fn init(c: *state, key: []u8) void;
fn init_salt(c: *state, key: []u8, salt: []u8) void;
fn new() state;

Types

type state[link]

Show undocumented member
type state = struct {
	block: cipher::block,
	p: [18]u32,
	s0: [256]u32,
	s1: [256]u32,
	s2: [256]u32,
	s3: [256]u32,
};

Constants

def BLOCKSZ[link]

def BLOCKSZ: size = 8;

The block size of the Blowfish cipher in bytes.

Functions

fn init[link]

fn init(c: *state, key: []u8) void;

Performs key expansion for a Blowfish cipher.

fn init_salt[link]

fn init_salt(c: *state, key: []u8, salt: []u8) void;

Performs salted key expansion for a Blowfish cipher.

fn new[link]

fn new() state;

Initializes a new Blowfish cipher. The user should must call init or init_salt prior to use, then may use crypto::cipher::encrypt et al. The user must call finish when they are done using the stream to securely erase secret information stored in the stream state.