KeccakTools
|
#include <Keccak-fTrails.h>
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 |
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().
Trail::Trail | ( | ) |
This constructor creates an empty trail.
Trail::Trail | ( | istream & | fin | ) |
This constructor loads a trail from an input stream.
fin | The 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.
other | The original trail to copy. |
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.
state | The state to add. |
weight | The propagation weight. |
void Trail::append | ( | const Trail & | otherTrail | ) |
This method appends another trail to the current trail.
otherTrail | The trail to append. |
void Trail::display | ( | const KeccakFPropagation & | DCorLC, |
ostream & | fout | ||
) | const |
This method displays the trail for in a human-readable form.
DCorLC | The propagation context of the trail, as a reference to a KeccakFPropagation object. |
fout | The stream to display to. |
void Trail::load | ( | istream & | fin | ) |
This methods loads the trail from a stream (e.g., file).
fin | The 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.
state | The state to add. |
weight | The 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().
DCorLC | The propagation context of the trails, as a reference to a KeccakFPropagation object. |
fileName | The name of the file containing the trails. |
verbose | If true, the function will display the name of the file written to cout. |
maxWeight | As in KeccakFPropagation::displayTrailsAndCheck(). |
void Trail::save | ( | ostream & | fout | ) | const |
This methods outputs the trail to save it in, e.g., a file.
fout | The stream to save the trail to. |
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.