Main Page Modules Data Structures File List Data Fields Globals Related Pages

# beecrypt/blowfish.c File Reference

Blowfish block cipher, code. More...

`#include "system.h"`
`#include "beecrypt.h"`
`#include "blowfishopt.h"`
`#include "blowfish.h"`
`#include "endianness.h"`
`#include "debug.h"`

Go to the source code of this file.

## Defines

#define | EROUND(l, r) l ^= *(p++); r ^= ((s[((l>>24)&0xff)+0x000]+s[((l>>16)&0xff)+0x100])^s[((l>>8)&0xff)+0x200])+s[((l>>0)&0xff)+0x300]
#define | DROUND(l, r) l ^= *(p--); r ^= ((s[((l>>24)&0xff)+0x000]+s[((l>>16)&0xff)+0x100])^s[((l>>8)&0xff)+0x200])+s[((l>>0)&0xff)+0x300]

## Functions

int | blowfishSetup (blowfishParam *bp, const uint32 *key, int keybits, cipherOperation op)
int | blowfishSetIV (blowfishParam *bp, const uint32 *iv)
int | blowfishEncrypt (blowfishParam *bp, uint32 *dst, const uint32 *src)
int | blowfishDecrypt (blowfishParam *bp, uint32 *dst, const uint32 *src)
int | blowfishECBEncrypt (blowfishParam *bp, int count, uint32 *dst, const uint32 *src)
int | blowfishECBDecrypt (blowfishParam *bp, int count, uint32 *dst, const uint32 *src)
int | blowfishCBCEncrypt (blowfishParam *bp, int count, uint32 *dst, const uint32 *src)
int | blowfishCBCDecrypt (blowfishParam *bp, int count, uint32 *dst, const uint32 *src)

## Variables

uint32 | _bf_p [(16+2)]
uint32 | _bf_s [1024]
const blockMode | blowfishModes [2]
const blockCipher | blowfish = { "Blowfish", sizeof(blowfishParam), 8, 64, 448, 32, (blockCipherSetup) blowfishSetup, (blockCipherSetIV) blowfishSetIV, (blockCipherEncrypt) blowfishEncrypt, (blockCipherDecrypt) blowfishDecrypt, blowfishModes }

## Detailed Description

Blowfish block cipher, code.

For more information on this blockcipher, see: "Applied Cryptography", second edition Bruce Schneier Wiley & Sons

Also see: http://www.counterpane.com/blowfish.html

Definition in file blowfish.c.

## Define Documentation

#define DROUND | ( | l,
|  | r |  | ) | l ^= *(p--); r ^= ((s[((l>>24)&0xff)+0x000]+s[((l>>16)&0xff)+0x100])^s[((l>>8)&0xff)+0x200])+s[((l>>0)&0xff)+0x300]

| Definition at line 316 of file blowfish.c. Referenced by blowfishDecrypt.

#define EROUND | ( | l,
|  | r |  | ) | l ^= *(p++); r ^= ((s[((l>>24)&0xff)+0x000]+s[((l>>16)&0xff)+0x100])^s[((l>>8)&0xff)+0x200])+s[((l>>0)&0xff)+0x300]

| Definition at line 315 of file blowfish.c. Referenced by blowfishEncrypt.

## Variable Documentation

uint32 _bf_p[ ( 16 +2) ]`[static]`

Initial value:

     {
            0x243f6a88, 0x85a308d3, 0x13198a2e, 0x03707344,
            0xa4093822, 0x299f31d0, 0x082efa98, 0xec4e6c89,
            0x452821e6, 0x38d01377, 0xbe5466cf, 0x34e90c6c,
            0xc0ac29b7, 0xc97c50dd, 0x3f84d5b5, 0xb5470917,
            0x9216d5d9, 0x8979fb1b
    }

Definition at line 45 of file blowfish.c.

Referenced by blowfishSetup.

uint32 _bf_s[1024]`[static]`

| Definition at line 56 of file blowfish.c. Referenced by blowfishSetup.

const blockMode blowfishModes[2]`[static]`

Initial value:

    {
            {  (blockModeEncrypt) blowfishECBEncrypt, (blockModeDecrypt) blowfishECBDecrypt },
            {  (blockModeEncrypt) blowfishCBCEncrypt, (blockModeDecrypt) blowfishCBCDecrypt }
    }

Definition at line 321 of file blowfish.c.