Bunny2.0
|
00001 #include "Bunny.h" 00002 00004 00009 template <unsigned nb_key, unsigned nround> 00010 class BunnyAES : public Bunny<128,nb_key,8,nround> { 00011 public: 00012 00013 typedef Bunny<128,nb_key,8,nround> BUNNY ; 00014 00015 typedef typename BUNNY::msgType msgType ; 00016 typedef typename BUNNY::keyType keyType ; 00017 typedef typename BUNNY::sboxType sboxType ; 00018 typedef typename BUNNY::wordType wordType ; 00019 typedef typename BUNNY::roundkeyType roundkeyType ; 00020 00022 roundkeyType rk; 00023 00024 // CONSTRUCTORS 00025 BunnyAES() ; 00026 00027 // CODING FUNCTIONS 00028 virtual msgType encode(msgType m, keyType k) ; 00029 virtual msgType decode(msgType m, keyType k) ; 00030 00031 //private: 00032 //se le metto private non posso testarle!! 00033 00034 // SBOX 00035 00036 virtual msgType sBox ( msgType m ) ; // sBox based on sbox 00037 virtual msgType sBoxInverse ( msgType m ) ; // sBox based on sbox 00038 00039 virtual sboxType sbox ( unsigned nbox, sboxType x ) ; 00040 virtual sboxType sboxInverse( unsigned nbox, sboxType x ) ; 00041 00042 // MIXING LAYER 00043 virtual msgType mixingLayer ( msgType m ) ; 00044 virtual msgType mixingLayerInverse ( msgType m ) ; 00045 00046 msgType shiftRows ( msgType m ) const ; 00047 msgType shiftRowsInv ( msgType m ) const ; 00048 msgType mixColumns ( msgType m ) const ; 00049 msgType mixColumnsInv ( msgType m ) const ; 00050 00051 // ADD ROUND KEY 00052 //virtual msgType addRoundKey (msgType m, msgType k) ; 00053 00054 // KEY SCHEDULE 00055 virtual void keySchedule(keyType k) ; 00056 00057 } ; 00058 00059 #include "BunnyAES.hxx"