KeccakTools

Trail Class Reference

#include <Keccak-fTrails.h>

List of all members.

Public Member Functions

 Trail ()
 Trail (istream &fin)
 Trail (const Trail &other)
void append (const vector< SliceValue > &state, unsigned int weight)
void append (const Trail &otherTrail)
void prepend (const vector< SliceValue > &state, unsigned int weight)
void display (const KeccakFPropagation &DCorLC, ostream &fout) const
void load (istream &fin)
void save (ostream &fout) const

Static Public Member Functions

static UINT64 produceHumanReadableFile (const KeccakFPropagation &DCorLC, const string &fileName, bool verbose=true, unsigned int maxWeight=0)

Public Attributes

vector< vector< SliceValue > > states
vector< unsigned int > weights
unsigned int totalWeight

Detailed Description

This class implements a container for a differential or linear trail. A trail makes sense only in the context of a KeccakFPropagation object. The main attribute of the class is the sequence of state values before χ. If Si = states[i], the trail is: S0 χλ S1 χλ S2 χλ ... χλ Sn-1, with n = states.size().


Constructor & Destructor Documentation

Trail::Trail ( )

This constructor creates an empty trail.

Trail::Trail ( istream &  fin)

This constructor loads a trail from an input stream.

Parameters:
finThe input stream to read the trail from.
Trail::Trail ( const Trail other) [inline]

This constructor initializes a trail by copying the trail given in parameter.

Parameters:
otherThe original trail to copy.

Member Function Documentation

void Trail::append ( const vector< SliceValue > &  state,
unsigned int  weight 
)

This method appends a state to the end of states, with its corresponding propagation weight.

Parameters:
stateThe state to add.
weightThe propagation weight.
void Trail::append ( const Trail otherTrail)

This method appends another trail to the current trail.

Parameters:
otherTrailThe trail to append.
void Trail::display ( const KeccakFPropagation DCorLC,
ostream &  fout 
) const

This method displays the trail for in a human-readable form.

Parameters:
DCorLCThe propagation context of the trail, as a reference to a KeccakFPropagation object.
foutThe stream to display to.
void Trail::load ( istream &  fin)

This methods loads the trail from a stream (e.g., file).

Parameters:
finThe input stream to read the trail from.
void Trail::prepend ( const vector< SliceValue > &  state,
unsigned int  weight 
)

This method inserts a state at the beginning of states, with its corresponding propagation weight.

Parameters:
stateThe state to add.
weightThe propagation weight.
UINT64 Trail::produceHumanReadableFile ( const KeccakFPropagation DCorLC,
const string &  fileName,
bool  verbose = true,
unsigned int  maxWeight = 0 
) [static]

This function reads all the trails in a file, checks their consistency and then produces a report. The report is output in a file with the same file name plus ".txt". See also KeccakFPropagation::displayTrailsAndCheck().

Parameters:
DCorLCThe propagation context of the trails, as a reference to a KeccakFPropagation object.
fileNameThe name of the file containing the trails.
verboseIf true, the function will display the name of the file written to cout.
maxWeightAs in KeccakFPropagation::displayTrailsAndCheck().
Returns:
The number of trails read and checked.
void Trail::save ( ostream &  fout) const

This methods outputs the trail to save it in, e.g., a file.

Parameters:
foutThe stream to save the trail to.

Member Data Documentation

vector<vector<SliceValue> > Trail::states

This attribute contains the list of states round after round, before χ.

unsigned int Trail::totalWeight

This attribute contains the sum of the weights[i].

vector<unsigned int> Trail::weights

This attribute contains the propagation weights of the states in states. So, weights has the same size as states.


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