Bunny2.0
|
Bunny24m24k CLASS. More...
#include <Bunny24m24k.h>
Public Types | |
typedef Bunny< 24, 24, nb_sbox, 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 | |
Bunny24m24k () | |
Constructor. | |
virtual msgType | encode (msgType m, keyType k) |
virtual msgType | decode (msgType m, keyType k) |
virtual sboxType | sbox (unsigned nbox, sboxType x) |
S-Boxes. | |
virtual sboxType | sboxInverse (unsigned nbox, sboxType x) |
Inverse of the S-Boxes. | |
virtual msgType | mixingLayer (msgType m) |
virtual msgType | mixingLayerInverse (msgType m) |
virtual msgType | addRoundKey (msgType m, msgType k) |
virtual void | keySchedule (keyType k) |
Public Attributes | |
roundkeyType | rk |
Contains the round keys. |
Bunny24m24k CLASS.
This class allows to instantiate a block cipher working on 24 bits, with a master key of 24 bits, whose s-boxes take input of nb_sbox bits, and with nround rounds.
Bunny24m24k< nb_sbox, nround >::Bunny24m24k | ( | ) | [inline] |
Constructor.
Allocate the space needed to fill a vector containing all the round keys.
Bunny24m24k< nb_sbox, nround >::msgType Bunny24m24k< nb_sbox, nround >::addRoundKey | ( | msgType | m, |
msgType | k | ||
) | [inline, virtual] |
Add round key STEP.
Sum with a round key k, which must be the same length of the message m.
Reimplemented from Bunny< 24, 24, nb_sbox, nround >.
Bunny24m24k< nb_sbox, nround >::msgType Bunny24m24k< nb_sbox, nround >::decode | ( | msgType | m, |
keyType | k | ||
) | [inline, virtual] |
Decoding function for Bunny block cipher.
Reimplemented from Bunny< 24, 24, nb_sbox, nround >.
Bunny24m24k< nb_sbox, nround >::msgType Bunny24m24k< nb_sbox, nround >::encode | ( | msgType | m, |
keyType | k | ||
) | [inline, virtual] |
Encoding function for Bunny block cipher.
Reimplemented from Bunny< 24, 24, nb_sbox, nround >.
void Bunny24m24k< nb_sbox, nround >::keySchedule | ( | keyType | k | ) | [inline, virtual] |
Key-Schedule STEP - Bunny's style.
Reimplemented from Bunny< 24, 24, nb_sbox, nround >.
Bunny24m24k< nb_sbox, nround >::msgType Bunny24m24k< nb_sbox, nround >::mixingLayer | ( | msgType | m | ) | [inline, virtual] |
Mixing-Layer STEP.
It is always a linear function, which in the case of Bunny block cipher it is implemented as a multiplication by a 24x24 matrix.
Implements Bunny< 24, 24, nb_sbox, nround >.
Bunny24m24k< nb_sbox, nround >::msgType Bunny24m24k< nb_sbox, nround >::mixingLayerInverse | ( | msgType | m | ) | [inline, virtual] |
Mixing-Layer Inverse STEP.
Implements Bunny< 24, 24, nb_sbox, nround >.
Bunny24m24k< nb_sbox, nround >::sboxType Bunny24m24k< nb_sbox, nround >::sbox | ( | unsigned | nbox, |
sboxType | x | ||
) | [inline, virtual] |
S-Boxes.
S-box 1.
over
where
is the field
--> Equivalent to Inversion.
This sbox is 4-differential and weakly APN.
EX:
000000 -> 000000
000010 -> 101101 ...
bitset<6> s1_table[2] = {
000000,000001,101101,110110,111011,010010,011011,011110,110000,001010,001001,110001,100000,111110,001111,001110,
011000,110011,000101,111010,101001,111000,110101,100011,010000,110010,011111,000110,101010,100110,000111,011010,
001100,111111,110100,010111,101111,111101,011101,101011,111001,010100,011100,100111,110111,000010,111100,100100,
001000,001011,011001,010001,100010,010110,000011,101100,010101,101000,010011,000100,101110,100101,001101,100001 };
------------------------------------------------------------------------------------------------------------------
S-box 2.
over
where
is the field
.
This sbox is 4-differential, but NO weakly APN.
EX: 000000 -> 000000
000010 -> 100000 ...
bitset<6> s2_table[64] = {
000000,000001,100000,110011,110001,000011,111111,011111,100100,000100,111011,001001,111110,101101,001111,001110,
000111,000101,110110,100110,001000,111001,010111,110100,011110,111101,010000,100001,111010,101010,011010,011000,
001101,101011,010110,100010,101001,111100,011100,011011,110111,110000,010011,000110,111000,001100,110010,010100,
101111,001010,100101,010010,110101,100011,010001,010101,101000,101100,011101,001011,011001,101110,000010,100111};
------------------------------------------------------------------------------------------------------------------
S-box 3.
over
where
is the field
.
This sbox is 4-differential, but NO weakly APN.
EX:
000000 -> 000000
000010 -> 100110 ...
------------------------------------------------------------------------------------------------------------------
S-box 4.
over
where
is the field
.
This sbox is 4-differential, and weakly APN.
EX:
000000 -> 000000
000010 -> ...
Implements Bunny< 24, 24, nb_sbox, nround >.