Bunny2.0
Public Types | Public Member Functions | Public Attributes
Bunny24m24k< nb_sbox, nround > Class Template Reference

Bunny24m24k CLASS. More...

#include <Bunny24m24k.h>

Inheritance diagram for Bunny24m24k< nb_sbox, nround >:
Bunny< 24, 24, nb_sbox, nround >

List of all members.

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.

Detailed Description

template<unsigned nb_sbox, unsigned nround>
class Bunny24m24k< nb_sbox, nround >

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.


Constructor & Destructor Documentation

template<unsigned nb_sbox, unsigned nround>
Bunny24m24k< nb_sbox, nround >::Bunny24m24k ( ) [inline]

Constructor.

Allocate the space needed to fill a vector containing all the round keys.


Member Function Documentation

template<unsigned nb_sbox, unsigned nround>
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.

  • INPUT: a message m of type msgType, and a round key k of type msgType (the type must be the same as the message, otherwise they can't be added together)
  • OUTPUT: the exor of m and k

Reimplemented from Bunny< 24, 24, nb_sbox, nround >.

template<unsigned nb_sbox, unsigned nround>
Bunny24m24k< nb_sbox, nround >::msgType Bunny24m24k< nb_sbox, nround >::decode ( msgType  m,
keyType  k 
) [inline, virtual]

Decoding function for Bunny block cipher.

  • INPUT: a message m of type msgType (a bitset of dimension N) and a key k of type keyType (a bitset of dimension M).
  • OUTPUT: an (decrypted) message c of the same type as m.

Reimplemented from Bunny< 24, 24, nb_sbox, nround >.

template<unsigned nb_sbox, unsigned nround>
Bunny24m24k< nb_sbox, nround >::msgType Bunny24m24k< nb_sbox, nround >::encode ( msgType  m,
keyType  k 
) [inline, virtual]

Encoding function for Bunny block cipher.

  • INPUT: a message m of type msgType (a bitset of dimension N) and a key k of type keyType (a bitset of dimension M).
  • OUTPUT: an (encrypted) message c of the same type as m.

Reimplemented from Bunny< 24, 24, nb_sbox, nround >.

template<unsigned nb_sbox, unsigned nround>
void Bunny24m24k< nb_sbox, nround >::keySchedule ( keyType  k) [inline, virtual]

Key-Schedule STEP - Bunny's style.

  • INPUT: a master key k of type keyType.
  • OUTPUT: return a pointer to a vector of msgType (this elements are the round key, which must be the same length/type as the message).

Reimplemented from Bunny< 24, 24, nb_sbox, nround >.

template<unsigned nb_sbox, unsigned 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.

  • INPUT: a message m of type msgType.
  • OUTPUT: the message m elaborated by the mixing layer.

Implements Bunny< 24, 24, nb_sbox, nround >.

template<unsigned nb_sbox, unsigned 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 >.

template<unsigned nb_sbox, unsigned nround>
Bunny24m24k< nb_sbox, nround >::sboxType Bunny24m24k< nb_sbox, nround >::sbox ( unsigned  nbox,
sboxType  x 
) [inline, virtual]

S-Boxes.

S-box 1.

$ x^{62} $ over $ F_2^6 $ where $ F $ is the field $ {0,1} $ --> 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.

$ x^5 $ over $ F_2^6 $ where $ F $ is the field $ {0,1} $ .

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.

$ x^17 $ over $ F_2^6 $ where $ F $ is the field $ {0,1} $ .

This sbox is 4-differential, but NO weakly APN.

EX:

000000 -> 000000

000010 -> 100110 ...

------------------------------------------------------------------------------------------------------------------

S-box 4.

$ x^62 + e^2 $ over $ F_2^6 $ where $ F $ is the field $ {0,1} $ .

This sbox is 4-differential, and weakly APN.

EX:

000000 -> 000000

000010 -> ...

Implements Bunny< 24, 24, nb_sbox, nround >.


The documentation for this class was generated from the following files:
 All Classes Functions Variables Typedefs