PTLib  Version 2.10.4
PTEACypher Class Reference

Tiny Encryption Algorithm. More...

#include <cypher.h>

Inheritance diagram for PTEACypher:
PCypher PObject

List of all members.

Classes

struct  Key

Public Member Functions

 PTEACypher (BlockChainMode chainMode=ElectronicCodebook)
 Create a new TEA encryption object instance.
 PTEACypher (const Key &keyData, BlockChainMode chainMode=ElectronicCodebook)
void SetKey (const Key &newKey)
 Set the key used by this encryption method.
void GetKey (Key &newKey) const
 Get the key used by this encryption method.

Static Public Member Functions

static void GenerateKey (Key &newKey)
 Generate a new key suitable for use for encryption using random data.

Protected Member Functions

virtual void Initialise (PBoolean encoding)
 Initialise the encoding/decoding sequence.
virtual void EncodeBlock (const void *in, void *out)
 Encode an n bit block of memory according to the encryption algorithm.
virtual void DecodeBlock (const void *in, void *out)
 Decode an n bit block of memory according to the encryption algorithm.

Detailed Description

Tiny Encryption Algorithm.

This class implements the Tiny Encryption Algorithm by David Wheeler and Roger Needham at Cambridge University.

This is a simple algorithm using a 128 bit binary key and encrypts data in 64 bit blocks.


Constructor & Destructor Documentation

Create a new TEA encryption object instance.

The parameterless version automatically generates a new, random, key.

Parameters:
chainModeBlock chain mode
PTEACypher::PTEACypher ( const Key keyData,
BlockChainMode  chainMode = ElectronicCodebook 
)
Parameters:
keyDataKey for the encryption/decryption algorithm.
chainModeBlock chain mode

Member Function Documentation

virtual void PTEACypher::DecodeBlock ( const void *  in,
void *  out 
) [protected, virtual]

Decode an n bit block of memory according to the encryption algorithm.

Parameters:
inPointer to coded n bit block.
outPointer to clear n bit block.

Implements PCypher.

virtual void PTEACypher::EncodeBlock ( const void *  in,
void *  out 
) [protected, virtual]

Encode an n bit block of memory according to the encryption algorithm.

Parameters:
inPointer to clear n bit block.
outPointer to coded n bit block.

Implements PCypher.

static void PTEACypher::GenerateKey ( Key newKey) [static]

Generate a new key suitable for use for encryption using random data.

Parameters:
newKeyVariable to take the newly generated key.
void PTEACypher::GetKey ( Key newKey) const

Get the key used by this encryption method.

Parameters:
newKeyVariable to take the key used by cypher.
virtual void PTEACypher::Initialise ( PBoolean  encoding) [protected, virtual]

Initialise the encoding/decoding sequence.

Parameters:
encodingFlag for encoding/decoding sequence about to start.

Implements PCypher.

void PTEACypher::SetKey ( const Key newKey)

Set the key used by this encryption method.

Parameters:
newKeyVariable to take the key used by cypher.

The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines