Unix
Mac OS X
Windows
Options
Unix
Windows

# Module twofish Methods

## AcquireTwofishInfo

AcquireTwofishInfo() allocate the TwofishInfo structure.

The format of the AcquireTwofishInfo method is:

      TwofishInfo *AcquireTwofishInfo(void)

## DecipherTwofishBlock

DecipherTwofishBlock() deciphers a single block of ciphertext to produce a block of plaintext.

The format of the DecipherTwofishBlock method is:

           void DecipherTwofishBlock(TwofishInfo *twofish_info,
       const unsigned char *ciphertext,unsigned char plaintext)

A description of each parameter follows:

##### twofish_info

The cipher context.

##### ciphertext

The cipher text.

##### plaintext

The plaint text.

## DestroyTwofishInfo

DestroyTwofishInfo() zeros memory associated with the TwofishInfo structure.

The format of the DestroyTwofishInfo method is:

      TwofishInfo *DestroyTwofishInfo(TwofishInfo *twofish_info)

A description of each parameter follows:

##### twofish_info

The cipher context.

## EncipherTwofishBlock

EncipherTwofishBlock() encipher a single block of plaintext to produce a block of ciphertext.

The format of the EncipherTwofishBlock method is:

      void EncipherTwofishBlock(TwofishInfo *twofish_info,
        const unsigned char *plaintext,unsigned char *ciphertext)

A description of each parameter follows:

##### twofish_info

The cipher context.

##### plaintext

The plain text.

##### ciphertext

The cipher text.

## GetTwofishBlocksize

GetTwofishBlocksize() returns the Twofish blocksize.

The format of the GetTwofishBlocksize method is:

      unsigned int *GetTwofishBlocksize(const TwofishInfo *twofish_info)

A description of each parameter follows:

##### twofish_info

The twofish info.

## SetTwofishKey

SetTwofishKey() sets the key for the Twofish cipher. The key length is specified in bits. Valid values are 128, 192, or 256 requiring a key buffer length in bytes of 16, 24, and 32 respectively.

The format of the SetTwofishKey method is:

      SetTwofishKey(TwofishInfo *twofish_info,const StringInfo *key)

A description of each parameter follows:

##### twofish_info

The cipher context.

##### key

The key.

Discourse Server