Bunny2.0
|
#include <BunnyAES.h>
Public Types | |
typedef Bunny< 128, nb_key, 8, nround > | BUNNY |
typedef BUNNY::msgType | msgType |
Is the type of a message string (e.g., bitset<128>, bitset<24>, etc..) | |
typedef BUNNY::keyType | keyType |
Is the type of a key string (e.g., bitset<256>, bitset<128>, etc..) | |
typedef BUNNY::sboxType | sboxType |
Is the type of a message string which is input into the sBox (e.g., bitset<8>, bitset<6>, etc..) | |
typedef BUNNY::wordType | wordType |
Is the type of a word string, used in the keyschedule or in the mixing layer (e.g., bitset<128*4>, etc..) | |
typedef BUNNY::roundkeyType | roundkeyType |
Is the type of the vector containing the round keys. | |
Public Member Functions | |
BunnyAES () | |
virtual msgType | encode (msgType m, keyType k) |
Encoding function designed for AES block cipher. | |
virtual msgType | decode (msgType m, keyType k) |
Decoding function designed for AES block cipher. | |
virtual msgType | sBox (msgType m) |
AES S-box STEP. | |
virtual msgType | sBoxInverse (msgType m) |
AES S-box Inverse STEP. | |
virtual sboxType | sbox (unsigned nbox, sboxType x) |
S-box table. | |
virtual sboxType | sboxInverse (unsigned nbox, sboxType x) |
Inverse of the sbox. | |
virtual msgType | mixingLayer (msgType m) |
Mixing Layer STEP. | |
virtual msgType | mixingLayerInverse (msgType m) |
Mixing Layer Inverse STEP. | |
msgType | shiftRows (msgType m) const |
ShiftRows STEP. | |
msgType | shiftRowsInv (msgType m) const |
ShiftRows Inverse STEP. | |
msgType | mixColumns (msgType m) const |
MixColumns STEP. | |
msgType | mixColumnsInv (msgType m) const |
MixColumns Inverse STEP. | |
virtual void | keySchedule (keyType k) |
Key-Schedule STEP - AES style. | |
Public Attributes | |
roundkeyType | rk |
Contains the round keys. |
BunnyAES CLASS.
This class inherits the methods from Bunny class, and specifies the virtual methods which are different from Bunny's.
BunnyAES allows to instantiate a block cipher as AES working on 128 bits, with a master key of nb_key bits, whose s-box take input of 8 bits, and with nround rounds.
Allocate the space needed to fill a vector containing all the round keys.
BunnyAES< nb_key, nround >::msgType BunnyAES< nb_key, nround >::decode | ( | msgType | m, |
keyType | k | ||
) | [inline, virtual] |
Decoding function designed for AES block cipher.
Reimplemented from Bunny< 128, nb_key, 8, nround >.
BunnyAES< nb_key, nround >::msgType BunnyAES< nb_key, nround >::encode | ( | msgType | m, |
keyType | k | ||
) | [inline, virtual] |
Encoding function designed for AES block cipher.
Reimplemented from Bunny< 128, nb_key, 8, nround >.
void BunnyAES< nb_key, nround >::keySchedule | ( | keyType | k | ) | [inline, virtual] |
Key-Schedule STEP - AES style.
Reimplemented from Bunny< 128, nb_key, 8, nround >.
BunnyAES< nb_key, nround >::msgType BunnyAES< nb_key, nround >::mixColumns | ( | msgType | m | ) | const [inline] |
MixColumns STEP.
It is AES mix columns step. It works for 128 bits messages. Takes 4 bytes at a time and creates a polynomial in ; this is then multiplied by another polynomial in the same field.
BunnyAES< nb_key, nround >::msgType BunnyAES< nb_key, nround >::mixColumnsInv | ( | msgType | m | ) | const [inline] |
MixColumns Inverse STEP.
Inverse of the mix columns step.
BunnyAES< nb_key, nround >::msgType BunnyAES< nb_key, nround >::mixingLayer | ( | msgType | m | ) | [inline, virtual] |
Mixing Layer STEP.
Combinations of the ShiftRows and the MixColumns steps.
Implements Bunny< 128, nb_key, 8, nround >.
BunnyAES< nb_key, nround >::msgType BunnyAES< nb_key, nround >::mixingLayerInverse | ( | msgType | m | ) | [inline, virtual] |
Mixing Layer Inverse STEP.
Combinations of the MixColumnsInverse and the ShiftRowsInverse steps.
Implements Bunny< 128, nb_key, 8, nround >.
BunnyAES< nb_key, nround >::sboxType BunnyAES< nb_key, nround >::sbox | ( | unsigned | nbox, |
sboxType | x | ||
) | [inline, virtual] |
S-box table.
This finction works with 8 bits.
Note: the parameter nbox is not used, but has to be inserted.
Implements Bunny< 128, nb_key, 8, nround >.
BunnyAES< nb_key, nround >::msgType BunnyAES< nb_key, nround >::sBox | ( | msgType | m | ) | [inline, virtual] |
AES S-box STEP.
This function receives a message and applies the sboxes as many times as needed (it uses alwayas the same sbox table):
m = (m_1, m_2, ..., m_3) ===> (sbox_1(m_1), sbox_2(m_2), ..., sbox_r(m_r))
Reimplemented from Bunny< 128, nb_key, 8, nround >.
BunnyAES< nb_key, nround >::sboxType BunnyAES< nb_key, nround >::sboxInverse | ( | unsigned | nbox, |
sboxType | x | ||
) | [inline, virtual] |
Inverse of the sbox.
This finction works with 8 bits.
Note: the parameter nbox is not used, but has to be inserted.
Implements Bunny< 128, nb_key, 8, nround >.
BunnyAES< nb_key, nround >::msgType BunnyAES< nb_key, nround >::shiftRows | ( | msgType | m | ) | const [inline] |
ShiftRows STEP.
It is AES shift rows. Works for msgType of 128 bits, grouped in a 4x4 matrix of 16 bytes.
BunnyAES< nb_key, nround >::msgType BunnyAES< nb_key, nround >::shiftRowsInv | ( | msgType | m | ) | const [inline] |
ShiftRows Inverse STEP.
Does the opposite operation as the ShiftRows.