#include <Keccak-fDCLC.h>
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< ListOfRowPatterns > | diffChi |
vector< ListOfRowPatterns > | diffInvChi |
vector< ListOfRowPatterns > | corrChi |
vector< ListOfRowPatterns > | corrInvChi |
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 θt(ρt(πt(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 |
|
) |
| |
Member Function Documentation
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:
-
trail | The trail to test the consistence of. |
DC | A 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. |
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:
-
trail | The trail to test the consistence of. |
LC | A 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. |
Apply the χ function on a single row value.
- Parameters:
-
- Returns:
- The output row value.
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:
-
fout | The stream to display to. |
DC | A pointer to the KeccakFPropagation instance specialized in differential cryptanalysis (can be null). |
LC | A 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:
-
lanes | The state as a vector of lanes. |
slices | The 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:
-
C | The parity as a vector of 5 lanes. |
D | The θ-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:
-
state | The 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:
-
parity | The 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:
-
C | The parity as a vector of 5 lanes. |
D | The θt-effect as a vector of 5 lanes. |
Apply the χ-1 function on a single row value.
- Parameters:
-
- Returns:
- The output row value.
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:
-
in | The input state as a vector of slices. |
out | The output state as a vector of slices. |
mode | The λ 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:
-
state | The state to process as a vector of lanes. |
mode | The λ mode. |
This method is the same as lambdaAfterTheta() but works on states represented as slices and internally uses the lambdaAfterThetaRowToSlice table.
- Parameters:
-
in | The input state as a vector of slices. |
out | The output state as a vector of slices. |
mode | The λ 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:
-
state | The state to process as a vector of lanes. |
mode | The λ mode. |
This method is the same as lambdaBeforeTheta() but works on states represented as slices and internally uses the lambdaBeforeThetaRowToSlice table.
- Parameters:
-
in | The input state as a vector of slices. |
out | The output state as a vector of slices. |
mode | The λ 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:
-
state | The state to process as a vector of lanes. |
mode | The λ mode. |
void KeccakFDCLC::thetaTransEnvelope |
( |
vector< LaneValue > & |
state | ) |
const |
This method inverts the order of bits in lanes and of lanes in planes.
- Parameters:
-
state | The 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:
-
A | The 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: