KeccakTools

AffineSpaceOfStates Class Reference

#include <Keccak-fAffineBases.h>

List of all members.

Public Member Functions

 AffineSpaceOfStates (unsigned int aLaneSize, vector< vector< SliceValue > > &aGenerators, vector< PackedParity > &aGeneratorParities, const vector< SliceValue > &aOffset, PackedParity aOffsetParity)
 AffineSpaceOfStates (unsigned int aLaneSize, vector< vector< SliceValue > > &aGenerators, vector< vector< RowValue > > &aGeneratorParities, const vector< SliceValue > &aOffset, const vector< RowValue > &aOffsetParity)
bool getOffsetWithGivenParity (PackedParity parity, vector< SliceValue > &output) const
bool getOffsetWithGivenParity (const vector< RowValue > &parity, vector< SliceValue > &output) const
SlicesAffineSpaceIterator getIterator () const
SlicesAffineSpaceIterator getIteratorWithGivenParity (PackedParity parity) const
SlicesAffineSpaceIterator getIteratorWithGivenParity (const vector< RowValue > &parity) const
SlicesAffineSpaceIterator getIteratorInKernel () const
void display (ostream &fout) const

Public Attributes

vector< vector< SliceValue > > originalGenerators
vector< vector< RowValue > > originalParities
vector< vector< SliceValue > > kernelGenerators
vector< vector< SliceValue > > offsetGenerators
vector< PackedParityoffsetParitiesPacked
vector< vector< RowValue > > offsetParities
vector< SliceValueoffset
PackedParity offsetParityPacked
vector< RowValueoffsetParity
bool packed

Protected Attributes

unsigned int laneSize

Detailed Description

This class expresses an affine space of states. The members of the affine space are determined by the offset plus any linear combination of the generators. The generators are split into two sets:

  • one set of generators that have a zero parity (called "parity-kernel"), and
  • one set of generators that have a non-zero parity (called "parity-offset"). This allows one to address a subspace of states with a given parity.

Constructor & Destructor Documentation

AffineSpaceOfStates::AffineSpaceOfStates ( unsigned int  aLaneSize,
vector< vector< SliceValue > > &  aGenerators,
vector< PackedParity > &  aGeneratorParities,
const vector< SliceValue > &  aOffset,
PackedParity  aOffsetParity 
)

This constructor initializes the different attributes from the given generators, the offset and their parities. This function is to be called only if the number of slices is low enough so that PackedParity can contain all the parities.

Note:
The passed vectors aGenerators and aGeneratorParities are modified in the process.
Parameters:
aLaneSizeThe lane size.
aGeneratorsThe set of generators of the affine space, each given as a vector of slices.
aGeneratorParitiesThe corresponding parities, each given in a PackedParity type.
aOffsetThe offset of the affine space, as a vector of slices.
aOffsetParityThe parity of the offset, given in a PackedParity type.
AffineSpaceOfStates::AffineSpaceOfStates ( unsigned int  aLaneSize,
vector< vector< SliceValue > > &  aGenerators,
vector< vector< RowValue > > &  aGeneratorParities,
const vector< SliceValue > &  aOffset,
const vector< RowValue > &  aOffsetParity 
)

This constructor initializes the different attributes from the given generators, the offset and their parities.

Note:
The passed vectors aGenerators and aGeneratorParities are modified in the process.
Parameters:
aLaneSizeThe lane size.
aGeneratorsThe set of generators of the affine space, each given as a vector of slices.
aGeneratorParitiesThe corresponding parities, each given as a vector of rows.
aOffsetThe offset of the affine space, as a vector of slices.
aOffsetParityThe parity of the offset, given as a vector of rows.

Member Function Documentation

void AffineSpaceOfStates::display ( ostream &  fout) const

This method displays the offset and generators.

Parameters:
foutThe stream to display to.
SlicesAffineSpaceIterator AffineSpaceOfStates::getIterator ( ) const

This method returns an iterator to all states in the affine space.

Returns:
The iterator to the whole affine space.
SlicesAffineSpaceIterator AffineSpaceOfStates::getIteratorInKernel ( ) const

Like getIteratorWithGivenParity() with the requested parity being zero.

Returns:
An iterator to all states in the affine space with zero parity (i.e., in the kernel).
SlicesAffineSpaceIterator AffineSpaceOfStates::getIteratorWithGivenParity ( const vector< RowValue > &  parity) const

This method returns an iterator to the affine space restricted to a given parity. In the returned iterator, its offset is computed as in method getOffsetWithGivenParity() and its generators are the parity-kernel generators.

Parameters:
parityThe requested parity.
Returns:
An iterator to all states in the affine space, restricted to the requested parity.
SlicesAffineSpaceIterator AffineSpaceOfStates::getIteratorWithGivenParity ( PackedParity  parity) const

This method returns an iterator to the affine space restricted to a given parity. In the returned iterator, its offset is computed as in method getOffsetWithGivenParity() and its generators are the parity-kernel generators.

Parameters:
parityThe requested parity.
Returns:
An iterator to all states in the affine space, restricted to the requested parity.
bool AffineSpaceOfStates::getOffsetWithGivenParity ( PackedParity  parity,
vector< SliceValue > &  output 
) const

This method returns a state value (in argument output) with a given parity. From the offset and the parity-offset generators of the affine space, this method computes an element that has the given parity. (Note that other elements with the same parity can be generated by adding any linear combination of parity-kernel generators.) If the given parity cannot be reached, false is returned.

Parameters:
parityThe requested parity.
outputThe state returned by the method with the requested parity, if possible.
Returns:
The method returns true iff a state can be found in the affine space with the requested parity.
bool AffineSpaceOfStates::getOffsetWithGivenParity ( const vector< RowValue > &  parity,
vector< SliceValue > &  output 
) const

This method returns a state value (in argument output) with a given parity. From the offset and the parity-offset generators of the affine space, this method computes an element that has the given parity. (Note that other elements with the same parity can be generated by adding any linear combination of parity-kernel generators.) If the given parity cannot be reached, false is returned.

Parameters:
parityThe requested parity.
outputThe state returned by the method with the requested parity, if possible.
Returns:
The method returns true iff a state can be found in the affine space with the requested parity.

Member Data Documentation

The set of parity-kernel generators of the affine space.

unsigned int AffineSpaceOfStates::laneSize [protected]

The lane size.

The offset of the affine space.

The set of parity-offset generators of the affine space. This can be used to generate an offset for a given parity. The parity-offset generators are organized such that their parity makes an upper-triangular matrix. In other words, whenever a generator has parity bit n set to 1 and parity bits m<n set to 0, the next generators necessarily have parity bits m<=n set to 0.

If packed is false, this vector contains the parities of offsetGenerators, i.e., offsetParities[i] contains the parity of offsetGenerators[i].

If packed is true, this vector contains the parities of offsetGenerators, i.e., offsetParitiesPacked[i] contains the parity of offsetGenerators[i].

If packed is false, the parity of the offset of the affine space.

If packed is true, the parity of the offset of the affine space.

The set of generators, before separation into parity-kernel and parity-offset sets.

The set of parities, before separation into parity-kernel and parity-offset sets, i.e., originalParities[i] contains the parity of originalGenerators[i].

This attribute indicates whether we are using the packed parities or not.


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