#include <iostream>#include <sstream>#include "Keccak-fParts.h"

Functions | |
| SliceValue | getSliceValue (RowValue row0, RowValue row1, RowValue row2, RowValue row3, RowValue row4) |
| unsigned int | getNrActiveRows (const SliceValue &slice) |
| unsigned int | getNrActiveRows (const vector< SliceValue > &slices) |
| unsigned int | getNrActiveRows (const vector< LaneValue > &lanes) |
| RowValue | translateRowSafely (RowValue row, int dx) |
| unsigned int | getHammingWeightRow (RowValue row) |
| SliceValue | translateSlice (SliceValue slice, unsigned int dx, unsigned int dy) |
| SliceValue | translateSliceSafely (SliceValue slice, int dx, int dy) |
| unsigned int | getHammingWeightSlice (SliceValue slice) |
| unsigned int | getHammingWeight (const vector< SliceValue > &state) |
| unsigned int | getHammingWeightLane (LaneValue lane) |
| unsigned int | getHammingWeight (const vector< LaneValue > &state) |
| void | getDisplayMap (const vector< SliceValue > &state, vector< unsigned int > &displayMap) |
| unsigned int | getDisplayNumberOfSpaces (const unsigned int &delta) |
| void | displayPlane (ostream &fout, const vector< SliceValue > &state, int offset, unsigned int y, const vector< unsigned int > &displayMap) |
| void | displayNothing (ostream &fout, const vector< SliceValue > &state, const vector< unsigned int > &displayMap) |
| void | displayParity (ostream &fout, const vector< SliceValue > &state, const int &offset, const vector< unsigned int > &displayMap) |
| void | displayState (ostream &fout, const vector< SliceValue > &state, bool showParity) |
| void | displayStates (ostream &fout, const vector< SliceValue > &state1, bool showParity1, const vector< SliceValue > &state2, bool showParity2) |
| void | displayStates (ostream &fout, const vector< SliceValue > &state1, bool showParity1, const vector< SliceValue > &state2, bool showParity2, const vector< SliceValue > &state3, bool showParity3) |
| void | translateStateAlongZ (vector< SliceValue > &state, unsigned int dz) |
| RowValue | getRow (const vector< LaneValue > &lanes, unsigned int y, unsigned int z) |
| void | setRow (vector< LaneValue > &lanes, RowValue row, unsigned int y, unsigned int z) |
| RowValue | getRow (const vector< SliceValue > &slices, unsigned int y, unsigned int z) |
| void | setRow (vector< SliceValue > &slices, RowValue row, unsigned int y, unsigned int z) |
| ColumnValue | getColumn (const vector< SliceValue > &slices, unsigned int x, unsigned int z) |
| void | setColumn (vector< SliceValue > &slices, ColumnValue column, unsigned int x, unsigned int z) |
| void | invertColumn (vector< SliceValue > &slices, unsigned int x, unsigned int z) |
| SliceValue | getSlice (const vector< LaneValue > &lanes, unsigned int z) |
| void | setSlice (vector< LaneValue > &lanes, SliceValue slice, unsigned int z) |
| void | fromLanesToSlices (const vector< LaneValue > &lanes, vector< SliceValue > &slices, unsigned int laneSize) |
| void | fromSlicesToLanes (const vector< SliceValue > &slices, vector< LaneValue > &lanes) |
Variables | |
| static const unsigned char | HammingWeightTable [256] |
| void displayNothing | ( | ostream & | fout, | |
| const vector< SliceValue > & | state, | |||
| const vector< unsigned int > & | displayMap | |||
| ) |
| void displayParity | ( | ostream & | fout, | |
| const vector< SliceValue > & | state, | |||
| const int & | offset, | |||
| const vector< unsigned int > & | displayMap | |||
| ) |
| void displayPlane | ( | ostream & | fout, | |
| const vector< SliceValue > & | state, | |||
| int | offset, | |||
| unsigned int | y, | |||
| const vector< unsigned int > & | displayMap | |||
| ) |
| void displayState | ( | ostream & | fout, | |
| const vector< SliceValue > & | state, | |||
| bool | showParity = false | |||
| ) |
This method outputs to fout the value of the state in a human readable way. The slices are displayed side by side.
| void displayStates | ( | ostream & | fout, | |
| const vector< SliceValue > & | state1, | |||
| bool | showParity1, | |||
| const vector< SliceValue > & | state2, | |||
| bool | showParity2, | |||
| const vector< SliceValue > & | state3, | |||
| bool | showParity3 | |||
| ) |
This method outputs to fout the value of the 3 states in a human readable way.
| void displayStates | ( | ostream & | fout, | |
| const vector< SliceValue > & | state1, | |||
| bool | showParity1, | |||
| const vector< SliceValue > & | state2, | |||
| bool | showParity2 | |||
| ) |
This method outputs to fout the value of the 2 states in a human readable way.
| void fromLanesToSlices | ( | const vector< LaneValue > & | lanes, | |
| vector< SliceValue > & | slices, | |||
| unsigned int | laneSize | |||
| ) |
This method creates the value of a state represented as a vector of slices from a state represented as a vector of lanes.
| slices | The destination for the slices. | |
| lanes | The state as a vector of lanes. | |
| laneSize | The lane size, which is also the number of slices. |
| void fromSlicesToLanes | ( | const vector< SliceValue > & | slices, | |
| vector< LaneValue > & | lanes | |||
| ) |
This method creates the value of a state represented as a vector of lanes from a state represented as a vector of slices.
| lanes | The destination for the lanes. | |
| slices | The state as a vector of slices. |
| ColumnValue getColumn | ( | const vector< SliceValue > & | slices, | |
| unsigned int | x = 0, |
|||
| unsigned int | z = 0 | |||
| ) |
This method returns the value of a given column in a slice.
| slices | The state as a vector of slices. | |
| x | The x coordinate. | |
| z | The z coordinate. |
| void getDisplayMap | ( | const vector< SliceValue > & | state, | |
| vector< unsigned int > & | displayMap | |||
| ) |
| unsigned int getDisplayNumberOfSpaces | ( | const unsigned int & | delta | ) | [inline] |
| unsigned int getHammingWeight | ( | const vector< LaneValue > & | state | ) |
This function returns the Hamming weight of the given state.
| unsigned int getHammingWeight | ( | const vector< SliceValue > & | state | ) |
This function returns the Hamming weight of the given state.
| unsigned int getHammingWeightLane | ( | LaneValue | lane | ) |
This function returns the Hamming weight of the given lane.
| unsigned int getHammingWeightRow | ( | RowValue | row | ) |
This function returns the Hamming weight of the given row value.
| unsigned int getHammingWeightSlice | ( | SliceValue | slice | ) |
This function returns the Hamming weight of the given slice value.
| unsigned int getNrActiveRows | ( | const vector< LaneValue > & | lanes | ) |
This method returns the number of active rows in the state given as lanes.
| unsigned int getNrActiveRows | ( | const vector< SliceValue > & | slices | ) |
This method returns the number of active rows in the state given as slices.
| unsigned int getNrActiveRows | ( | const SliceValue & | slice | ) |
This method returns the number of active rows in the given slice value.
| RowValue getRow | ( | const vector< SliceValue > & | slices, | |
| unsigned int | y = 0, |
|||
| unsigned int | z = 0 | |||
| ) |
This method returns the value of a given row in a slice.
| slices | The state as a vector of slices. | |
| y | The y coordinate. | |
| z | The z coordinate. |
This method returns the value of a given row in a slice.
| lanes | The state as a vector of lanes. | |
| y | The y coordinate. | |
| z | The z coordinate. |
| SliceValue getSlice | ( | const vector< LaneValue > & | lanes, | |
| unsigned int | z = 0 | |||
| ) |
This method returns the value of a given slice in a state represented as a vector of lanes.
| lanes | The state as a vector of lanes. | |
| z | The slice index (z coordinate). |
| SliceValue getSliceValue | ( | RowValue | row0, | |
| RowValue | row1, | |||
| RowValue | row2, | |||
| RowValue | row3, | |||
| RowValue | row4 | |||
| ) |
This method constructs a slice value from 5 row values.
| void invertColumn | ( | vector< SliceValue > & | slices, | |
| unsigned int | x = 0, |
|||
| unsigned int | z = 0 | |||
| ) |
This method complements all the bits of a particular column in a vector of slices.
| slices | The state as a vector of slices. | |
| x | The x coordinate. | |
| z | The z coordinate. |
| void setColumn | ( | vector< SliceValue > & | slices, | |
| ColumnValue | column, | |||
| unsigned int | x = 0, |
|||
| unsigned int | z = 0 | |||
| ) |
This method sets the value of a particular column in a vector of slices.
| slices | The state as a vector of slices. | |
| column | The row value. | |
| x | The x coordinate. | |
| z | The z coordinate. |
| void setRow | ( | vector< SliceValue > & | slices, | |
| RowValue | row, | |||
| unsigned int | y = 0, |
|||
| unsigned int | z = 0 | |||
| ) |
This method sets the value of a particular row in a vector of slices.
| slices | The state as a vector of slices. | |
| row | The row value. | |
| y | The y coordinate. | |
| z | The z coordinate. |
This method sets the value of a particular row in a vector of lanes.
| lanes | The state as a vector of lanes. | |
| row | The row value. | |
| y | The y coordinate. | |
| z | The z coordinate. |
| void setSlice | ( | vector< LaneValue > & | lanes, | |
| SliceValue | slice, | |||
| unsigned int | z = 0 | |||
| ) |
This method sets the value of a particular slice in a vector of lanes.
| lanes | The state as a vector of lanes. | |
| slice | The slice value. | |
| z | The z coordinate. |
Same as translateRow, but any (negative and positive) value of dx is allowed.
| SliceValue translateSlice | ( | SliceValue | slice, | |
| unsigned int | dx, | |||
| unsigned int | dy | |||
| ) |
This function translates a slice value along the X and Y axes and returns the translated value. Note that 0 <= dx < 5 and 0 <= dy < 5 are required.
| SliceValue translateSliceSafely | ( | SliceValue | slice, | |
| int | dx, | |||
| int | dy | |||
| ) |
Same as translateSlice(), but any (negative and positive) value of dx and dy is allowed.
| void translateStateAlongZ | ( | vector< SliceValue > & | state, | |
| unsigned int | dz | |||
| ) |
This function translates the state along the Z axis.
const unsigned char HammingWeightTable[256] [static] |
Initial value:
{
0, 1, 1, 2, 1, 2, 2, 3, 1, 2, 2, 3, 2, 3, 3, 4,
1, 2, 2, 3, 2, 3, 3, 4, 2, 3, 3, 4, 3, 4, 4, 5,
1, 2, 2, 3, 2, 3, 3, 4, 2, 3, 3, 4, 3, 4, 4, 5,
2, 3, 3, 4, 3, 4, 4, 5, 3, 4, 4, 5, 4, 5, 5, 6,
1, 2, 2, 3, 2, 3, 3, 4, 2, 3, 3, 4, 3, 4, 4, 5,
2, 3, 3, 4, 3, 4, 4, 5, 3, 4, 4, 5, 4, 5, 5, 6,
2, 3, 3, 4, 3, 4, 4, 5, 3, 4, 4, 5, 4, 5, 5, 6,
3, 4, 4, 5, 4, 5, 5, 6, 4, 5, 5, 6, 5, 6, 6, 7,
1, 2, 2, 3, 2, 3, 3, 4, 2, 3, 3, 4, 3, 4, 4, 5,
2, 3, 3, 4, 3, 4, 4, 5, 3, 4, 4, 5, 4, 5, 5, 6,
2, 3, 3, 4, 3, 4, 4, 5, 3, 4, 4, 5, 4, 5, 5, 6,
3, 4, 4, 5, 4, 5, 5, 6, 4, 5, 5, 6, 5, 6, 6, 7,
2, 3, 3, 4, 3, 4, 4, 5, 3, 4, 4, 5, 4, 5, 5, 6,
3, 4, 4, 5, 4, 5, 5, 6, 4, 5, 5, 6, 5, 6, 6, 7,
3, 4, 4, 5, 4, 5, 5, 6, 4, 5, 5, 6, 5, 6, 6, 7,
4, 5, 5, 6, 5, 6, 6, 7, 5, 6, 6, 7, 6, 7, 7, 8
}
1.5.6