Pol  Rev 533
TwoFish Class Reference

#include <twofish.h>

+ Collaboration diagram for TwoFish:

List of all members.

Public Member Functions

 TwoFish ()
 ~TwoFish ()
void Decrypt (unsigned char *in, unsigned char *out, int len)
void Init (unsigned char *gseed)

Public Attributes

unsigned char subData3 [256]

Protected Member Functions

void BlockEncrypt (CipherInstance *cipher, KeyInstance *key, unsigned char *input, int inputLen, unsigned char *outBuffer)
void CipherInit (CipherInstance *cipher, unsigned char mode, char *IV)
unsigned int F32 (unsigned int x, unsigned int *k32, int keyLen)
void MakeKey (KeyInstance *key, unsigned char direction, int keyLen, char *keyMaterial)
void ReKey (KeyInstance *key)
unsigned int RS_MDS_Encode (unsigned int k0, unsigned int k1)

Protected Attributes

CipherInstance ci
unsigned int dwIndex
KeyInstance ki
int numRounds [4]
int pos
unsigned int seed
int tabEnable
unsigned char tabUsed [256]

Detailed Description

Definition at line 34 of file twofish.h.


Constructor & Destructor Documentation

Definition at line 81 of file twofish.cpp.

Definition at line 84 of file twofish.cpp.


Member Function Documentation

void TwoFish::BlockEncrypt ( CipherInstance cipher,
KeyInstance key,
unsigned char *  input,
int  inputLen,
unsigned char *  outBuffer 
) [protected]

Definition at line 237 of file twofish.cpp.

References Bswap, F32(), tagcipherInstance::IV, tagcipherInstance::iv32, tagkeyInstance::keyLen, tagcipherInstance::mode, tagkeyInstance::numRounds, ROL, ROR, tagkeyInstance::sboxKeys, tagkeyInstance::subKeys, and x.

Referenced by Decrypt(), and Init().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void TwoFish::CipherInit ( CipherInstance cipher,
unsigned char  mode,
char *  IV 
) [protected]

Definition at line 210 of file twofish.cpp.

References Bswap, tagcipherInstance::cipherSig, tagcipherInstance::IV, tagcipherInstance::iv32, and tagcipherInstance::mode.

Referenced by Init().

+ Here is the caller graph for this function:

void TwoFish::Decrypt ( unsigned char *  in,
unsigned char *  out,
int  len 
)

Definition at line 121 of file twofish.cpp.

References BlockEncrypt(), ci, ki, pos, and subData3.

Referenced by CCryptBlowfishTwofish::Decrypt(), and CCryptTwofish::Decrypt().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

unsigned int TwoFish::F32 ( unsigned int  x,
unsigned int *  k32,
int  keyLen 
) [protected]

Definition at line 154 of file twofish.cpp.

References _b, Bswap, M00, M01, M02, M03, M10, M11, M12, M13, M20, M21, M22, M23, M30, M31, M32, M33, and p8.

Referenced by BlockEncrypt(), and ReKey().

+ Here is the caller graph for this function:

void TwoFish::Init ( unsigned char *  gseed)

Definition at line 90 of file twofish.cpp.

References BlockEncrypt(), ci, CipherInit(), dwIndex, tagkeyInstance::key32, ki, MakeKey(), numRounds, pos, ReKey(), seed, subData3, and tabEnable.

Referenced by CCryptBlowfishTwofish::Init(), and CCryptTwofish::Init().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void TwoFish::MakeKey ( KeyInstance key,
unsigned char  direction,
int  keyLen,
char *  keyMaterial 
) [protected]

Definition at line 223 of file twofish.cpp.

References tagkeyInstance::direction, tagkeyInstance::key32, tagkeyInstance::keyLen, tagkeyInstance::keyMaterial, tagkeyInstance::keySig, tagkeyInstance::numRounds, and numRounds.

Referenced by Init().

+ Here is the caller graph for this function:

void TwoFish::ReKey ( KeyInstance key) [protected]

Definition at line 184 of file twofish.cpp.

References F32(), tagkeyInstance::key32, tagkeyInstance::keyLen, tagkeyInstance::numRounds, ROL, RS_MDS_Encode(), tagkeyInstance::sboxKeys, and tagkeyInstance::subKeys.

Referenced by Init().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

unsigned int TwoFish::RS_MDS_Encode ( unsigned int  k0,
unsigned int  k1 
) [protected]

Definition at line 140 of file twofish.cpp.

References RS_rem.

Referenced by ReKey().

+ Here is the caller graph for this function:


Member Data Documentation

Definition at line 61 of file twofish.h.

Referenced by Decrypt(), and Init().

unsigned int TwoFish::dwIndex [protected]

Definition at line 64 of file twofish.h.

Referenced by Init().

KeyInstance TwoFish::ki [protected]

Definition at line 60 of file twofish.h.

Referenced by Decrypt(), and Init().

int TwoFish::numRounds[4] [protected]

Definition at line 67 of file twofish.h.

Referenced by Init(), and MakeKey().

int TwoFish::pos [protected]

Definition at line 66 of file twofish.h.

Referenced by Decrypt(), and Init().

unsigned int TwoFish::seed [protected]

Definition at line 63 of file twofish.h.

Referenced by Init().

unsigned char TwoFish::subData3[256]

Definition at line 49 of file twofish.h.

Referenced by Decrypt(), Init(), and CCryptTwofish::Init().

int TwoFish::tabEnable [protected]

Definition at line 65 of file twofish.h.

Referenced by Init().

unsigned char TwoFish::tabUsed[256] [protected]

Definition at line 62 of file twofish.h.


The documentation for this class was generated from the following files: