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

BunnyAES CLASS. More...

#include <BunnyAES.h>

Inheritance diagram for BunnyAES< nb_key, nround >:
Bunny< 128, nb_key, 8, nround >

List of all members.

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.

Detailed Description

template<unsigned nb_key, unsigned nround>
class BunnyAES< nb_key, nround >

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.


Constructor & Destructor Documentation

template<unsigned nb_key, unsigned nround>
BunnyAES< nb_key, nround >::BunnyAES ( ) [inline]

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


Member Function Documentation

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

Decoding function designed for AES 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< 128, nb_key, 8, nround >.

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

Encoding function designed for AES 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< 128, nb_key, 8, nround >.

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

Key-Schedule STEP - AES 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< 128, nb_key, 8, nround >.

template<unsigned nb_key, unsigned 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 $ F_2^8 $; this is then multiplied by another polynomial in the same field.

  • INPUT: a message m of type msgType.
  • OUTPUT: the message m elaborated by the mix columns step.
template<unsigned nb_key, unsigned nround>
BunnyAES< nb_key, nround >::msgType BunnyAES< nb_key, nround >::mixColumnsInv ( msgType  m) const [inline]

MixColumns Inverse STEP.

Inverse of the mix columns step.

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

  • INPUT: a message m of type msgType.
  • OUTPUT: the message m elaborated by shift rows and mix columns steps.

Implements Bunny< 128, nb_key, 8, nround >.

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

  • INPUT: a message m of type msgType.
  • OUTPUT: the message m elaborated by the inverse of mix columns and then the inverse of shift rows steps.

Implements Bunny< 128, nb_key, 8, nround >.

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

  • INPUT: an element x of type sboxType.
  • OUTPUT: an element of type sboxType elaborated by the sbox.

Note: the parameter nbox is not used, but has to be inserted.

Implements Bunny< 128, nb_key, 8, nround >.

template<unsigned nb_key, unsigned 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))

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

Reimplemented from Bunny< 128, nb_key, 8, nround >.

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

  • INPUT: an element x of type sboxType.
  • OUTPUT: an element of type sboxType elaborated by the inverse of the sbox function.

Note: the parameter nbox is not used, but has to be inserted.

Implements Bunny< 128, nb_key, 8, nround >.

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

  • INPUT: a message m of type msgType.
  • OUTPUT: the message m elaborated by the shiftrow step.
template<unsigned nb_key, unsigned nround>
BunnyAES< nb_key, nround >::msgType BunnyAES< nb_key, nround >::shiftRowsInv ( msgType  m) const [inline]

ShiftRows Inverse STEP.

Does the opposite operation as the ShiftRows.


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