KeccakTools

Duplex Class Reference

#include <duplex.h>

Collaboration diagram for Duplex:

List of all members.

Public Member Functions

 Duplex (const Transformation *aF, const PaddingRule *aPad, unsigned int aRate)
void duplexing (const UINT8 *input, unsigned int inputLengthInBits, UINT8 *output, unsigned int desiredOutputLengthInBits)
unsigned int getCapacity ()
unsigned int getMaximumInputLength ()
unsigned int getMaximumOutputLength ()
virtual string getDescription () const

Protected Member Functions

void computeRhoMax ()

Protected Attributes

const Transformationf
const PaddingRulepad
unsigned int capacity
unsigned int rate
unsigned int rho_max
auto_ptr< UINT8state

Friends

ostream & operator<< (ostream &a, const Duplex &duplex)

Detailed Description

Class implementing the duplex construction.


Constructor & Destructor Documentation

Duplex::Duplex ( const Transformation aF,
const PaddingRule aPad,
unsigned int  aRate 
)

The constructor. The transformation, padding rule and rate are given to the constructor, while the capacity is computed from the function width and the requested rate. The duplex construction is initialized.

Parameters:
aFA pointer to the transformation used in the sponge construction.
aPadA pointer to the padding rule used in the sponge construction.
aRateThe desired value of the rate (in bits), not necessarily a multiple of 8.

Member Function Documentation

void Duplex::computeRhoMax ( ) [protected]

Internal method to compute ρ_max, the maximum input length. This value is such that an input message fits in one block after padding.

void Duplex::duplexing ( const UINT8 input,
unsigned int  inputLengthInBits,
UINT8 output,
unsigned int  desiredOutputLengthInBits 
)

Method that performs a duplexing call. The input data is given as a sequence of bytes. Within each byte, the bits are understood to be ordered from the least significant bit to the most significant bit. The output data are given using the same structure.

Parameters:
inputThe input data. When inputLengthInBits is not a multiple of 8, the last bits of data must be in the least significant bits of the last byte.
inputLengthInBitsThe length in bits of the data provided in input. This value does not need to be a multiple of 8.
outputThe buffer where to store the output data.
desiredOutputLengthInBitsThe length in bits of the output.
Precondition:
inputLengthInBits ≤ getMaximumInputLength()
desiredOutputLengthInBits ≤ getMaximumOutputLength()
unsigned int Duplex::getCapacity ( )

Method that returns the capacity of the sponge function.

string Duplex::getDescription ( ) const [virtual]

Method that returns a string with a description of itself.

unsigned int Duplex::getMaximumInputLength ( )

Method that returns the maximum input length in bits of the duplexing() method.

unsigned int Duplex::getMaximumOutputLength ( )

Method that returns the maximum output length in bits of the duplexing() method.


Friends And Related Function Documentation

ostream& operator<< ( ostream &  a,
const Duplex duplex 
) [friend]

Method that prints a brief description of the sponge function.


Member Data Documentation

unsigned int Duplex::capacity [protected]

The capacity of the duplex construction.

const Transformation* Duplex::f [protected]

The transformation (or permutation) used by the sponge construction. The memory allocated by f is assumed to belong to the caller; this class does not free the allocated memory.

const PaddingRule* Duplex::pad [protected]

The padding rule used by the sponge construction. The memory allocated by pad is assumed to belong to the caller; this class does not free the allocated memory.

unsigned int Duplex::rate [protected]

The rate of the duplex construction.

unsigned int Duplex::rho_max [protected]

The maximum input length of the duplex construction.

auto_ptr<UINT8> Duplex::state [protected]

The state of the duplex construction.


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