KeccakTools

KeccakFDCLC Class Reference

#include <Keccak-fDCLC.h>

Inheritance diagram for KeccakFDCLC:
Collaboration diagram for KeccakFDCLC:

List of all members.

Public Types

enum  LambdaMode {
  Straight = 0, Inverse, Transpose, Dual,
  EndOfLambdaModes
}

Public Member Functions

 KeccakFDCLC (unsigned int aWidth, unsigned int aNrRounds=0)
string getDescription () const
void displayAll (ostream &fout, KeccakFPropagation *DC=0, KeccakFPropagation *LC=0) const
template<class Lane >
void thetaTransposed (vector< Lane > &A) const
void thetaTransEnvelope (vector< LaneValue > &state) const
template<class Lane >
void lambda (vector< Lane > &state, LambdaMode mode) const
void lambda (const vector< SliceValue > &in, vector< SliceValue > &out, LambdaMode mode) const
template<class Lane >
void lambdaBeforeTheta (vector< Lane > &state, LambdaMode mode) const
void lambdaBeforeTheta (const vector< SliceValue > &in, vector< SliceValue > &out, LambdaMode mode) const
template<class Lane >
void lambdaAfterTheta (vector< Lane > &state, LambdaMode mode) const
void lambdaAfterTheta (const vector< SliceValue > &in, vector< SliceValue > &out, LambdaMode mode) const
RowValue chiOnRow (RowValue a) const
RowValue inverseChiOnRow (RowValue a) const
void fromLanesToSlices (const vector< LaneValue > &lanes, vector< SliceValue > &slices) const
void checkDCTrail (const Trail &trail, KeccakFPropagation *DC=0) const
void checkLCTrail (const Trail &trail, KeccakFPropagation *LC=0) const
unsigned int getThetaGap (const vector< LaneValue > &state) const
unsigned int getThetaGapFromParity (const vector< LaneValue > &parity) const
template<class Lane >
void getThetaEffectFromParity (const vector< Lane > &C, vector< Lane > &D) const
template<class Lane >
void getThetaTransposedEffectFromParity (const vector< Lane > &C, vector< Lane > &D) const
virtual string getName () const

Public Attributes

vector< ListOfRowPatternsdiffChi
vector< ListOfRowPatternsdiffInvChi
vector< ListOfRowPatternscorrChi
vector< ListOfRowPatternscorrInvChi
vector< bool > thetaJustAfterChi
vector< bool > thetaJustBeforeChi

Detailed Description

This class is an extension of KeccakF with additional functionality aimed at differential and linear cryptanalysis.


Member Enumeration Documentation

In this context, λ represents the linear operations in Keccak-f between two applications of χ. The λ mode indicates whether to perform these operations, their transpose, their inverse or the transpose of their inverse.

  • Straight: λ(a) means π(ρ(θ(a)));
  • Inverse: λ(a) means θ-1-1-1(a)));
  • Transpose: λ(a) means θttt(a)))=θt-1-1(a)));
  • Dual: λ(a) means π(ρ(θ-1t(a))).
Enumerator:
Straight 
Inverse 
Transpose 
Dual 
EndOfLambdaModes 

Constructor & Destructor Documentation

KeccakFDCLC::KeccakFDCLC ( unsigned int  aWidth,
unsigned int  aNrRounds = 0 
)

This constructor has the same parameters as KeccakF::KeccakF.


Member Function Documentation

void KeccakFDCLC::checkDCTrail ( const Trail trail,
KeccakFPropagation DC = 0 
) const

This method checks the consistency of a DC trail given as parameter. If an inconsistency is found, a KeccakException is thrown and details about the inconsistency are displayed in the error console (cerr). The aspects tested are:

  • the propagation weights declared in the trail match the propagation weights of the specified differences;
  • between two rounds, the specified differences are compatible.
Parameters:
trailThe trail to test the consistence of.
DCA pointer to the KeccakFPropagation instance specialized in differential cryptanalysis. This pointer can be zero. It is only used for display purposes, in case an inconsistency is detected.
void KeccakFDCLC::checkLCTrail ( const Trail trail,
KeccakFPropagation LC = 0 
) const

This method checks the consistency of a LC trail given as parameter. If an inconsistency is found, a KeccakException is thrown and details about the inconsistency are displayed in the error console (cerr). The aspects tested are:

  • the propagation weights declared in the trail match the propagation weights of the specified masks;
  • between two rounds, the specified masks are compatible.
Parameters:
trailThe trail to test the consistence of.
LCA pointer to the KeccakFPropagation instance specialized in linear cryptanalysis. This pointer can be zero. It is only used for display purposes, in case an inconsistency is detected.
RowValue KeccakFDCLC::chiOnRow ( RowValue  a) const

Apply the χ function on a single row value.

Parameters:
aThe input row value.
Returns:
The output row value.
void KeccakFDCLC::displayAll ( ostream &  fout,
KeccakFPropagation DC = 0,
KeccakFPropagation LC = 0 
) const

This method displays all the possible output patterns (differences and selection vectors) for each input pattern. If the paramters DC and LC point to actual KeccakFPropagation instances, the affine descriptions are also given.

Parameters:
foutThe stream to display to.
DCA pointer to the KeccakFPropagation instance specialized in differential cryptanalysis (can be null).
LCA pointer to the KeccakFPropagation instance specialized in linear cryptanalysis (can be null).
void KeccakFDCLC::fromLanesToSlices ( const vector< LaneValue > &  lanes,
vector< SliceValue > &  slices 
) const [inline]

This method creates the value of a state represented as a vector of slices from a state represented as a vector of lanes.

Parameters:
lanesThe state as a vector of lanes.
slicesThe output state as a vector of slices.
string KeccakFDCLC::getDescription ( ) const [virtual]

This method retuns a string describing the instance.

Reimplemented from KeccakF.

string KeccakFDCLC::getName ( ) const [virtual]

Method that returns a short string that uniquely identifies the Keccak-f instance. Unlike the function in KeccakF, this function does not take the number of rounds into account in the description.

Returns:
The name of the instance.

Reimplemented from KeccakF.

template<class Lane >
void KeccakFDCLC::getThetaEffectFromParity ( const vector< Lane > &  C,
vector< Lane > &  D 
) const

This method computes the θ-effect of a state given as input. (See the Keccak main document for a definition of the θ-effect.)

Parameters:
CThe parity as a vector of 5 lanes.
DThe θ-effect as a vector of 5 lanes.
unsigned int KeccakFDCLC::getThetaGap ( const vector< LaneValue > &  state) const

This method computes the θ-gap of the state given as input. (See the Keccak main document for a definition of the θ-gap.)

Parameters:
stateThe state of which to compute the θ-gap as a vector of lanes.
Returns:
The θ-gap value.
unsigned int KeccakFDCLC::getThetaGapFromParity ( const vector< LaneValue > &  parity) const

This method computes the θ-gap from the parity of a state given as input. (See the Keccak main document for a definition of the θ-gap.)

Parameters:
parityThe parity of which to compute the θ-gap as a vector of 5 lanes.
Returns:
The θ-gap value.
template<class Lane >
void KeccakFDCLC::getThetaTransposedEffectFromParity ( const vector< Lane > &  C,
vector< Lane > &  D 
) const

This method computes the θt-effect of a state given as input. (The θt-effect is defined like the θ-effect but on the transposed θ.)

Parameters:
CThe parity as a vector of 5 lanes.
DThe θt-effect as a vector of 5 lanes.
RowValue KeccakFDCLC::inverseChiOnRow ( RowValue  a) const

Apply the χ-1 function on a single row value.

Parameters:
aThe input row value.
Returns:
The output row value.
void KeccakFDCLC::lambda ( const vector< SliceValue > &  in,
vector< SliceValue > &  out,
LambdaMode  mode 
) const

This method applies the λ function (see LambdaMode) using the lambdaRowToSlice table. The input is a vector of laneSize slice values, and so is the output. The mode argument gives the λ mode (i.e., inverse/transpose) to use.

Parameters:
inThe input state as a vector of slices.
outThe output state as a vector of slices.
modeThe λ mode.
Precondition:
This assumes that in has size equal to laneSize.
template<class Lane >
void KeccakFDCLC::lambda ( vector< Lane > &  state,
LambdaMode  mode 
) const

This method applies the linear transformation (see LambdaMode) between two χ's.

Parameters:
stateThe state to process as a vector of lanes.
modeThe λ mode.
void KeccakFDCLC::lambdaAfterTheta ( const vector< SliceValue > &  in,
vector< SliceValue > &  out,
LambdaMode  mode 
) const

This method is the same as lambdaAfterTheta() but works on states represented as slices and internally uses the lambdaAfterThetaRowToSlice table.

Parameters:
inThe input state as a vector of slices.
outThe output state as a vector of slices.
modeThe λ mode.
Precondition:
This assumes that in has size equal to laneSize.
template<class Lane >
void KeccakFDCLC::lambdaAfterTheta ( vector< Lane > &  state,
LambdaMode  mode 
) const

Among the linear transformation steps (or its inverse and/or transpose) between two χ's, this method applies the linear steps that come after θ.

Parameters:
stateThe state to process as a vector of lanes.
modeThe λ mode.
void KeccakFDCLC::lambdaBeforeTheta ( const vector< SliceValue > &  in,
vector< SliceValue > &  out,
LambdaMode  mode 
) const

This method is the same as lambdaBeforeTheta() but works on states represented as slices and internally uses the lambdaBeforeThetaRowToSlice table.

Parameters:
inThe input state as a vector of slices.
outThe output state as a vector of slices.
modeThe λ mode.
Precondition:
This assumes that in has size equal to laneSize.
template<class Lane >
void KeccakFDCLC::lambdaBeforeTheta ( vector< Lane > &  state,
LambdaMode  mode 
) const

Among the linear transformation steps (see LambdaMode) between two χ's, this method applies the linear steps that come before θ.

Parameters:
stateThe state to process as a vector of lanes.
modeThe λ mode.
void KeccakFDCLC::thetaTransEnvelope ( vector< LaneValue > &  state) const

This method inverts the order of bits in lanes and of lanes in planes.

Parameters:
stateThe state to process as a vector of lanes.
template<class Lane >
void KeccakFDCLC::thetaTransposed ( vector< Lane > &  A) const

Template method that applies θt (θ transposed).

Parameters:
AThe given state is organized as a vector of lanes.

Member Data Documentation

This attribute contains the output linear masks for the non-linear function χ. The index of the vector corresponds to the input mask.

This attribute contains the output linear masks for the non-linear function χ-1. The index of the vector corresponds to the input mask.

This attribute contains the output difference patterns for the non-linear function χ. The index of the vector corresponds to the input difference pattern.

This attribute contains the output difference patterns for the non-linear function χ-1. The index of the vector corresponds to the input difference pattern.

This attribute indicates, for each λ mode (see LambdaMode), if θ is just after χ. When true, this means that lambdaBeforeTheta() is the identity.

This attribute indicates, for each λ mode (see LambdaMode), if θ is just before χ. When true, this means that lambdaAfterTheta() is the identity.


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