Exemple #1
0
 def __init__(self, logLevel, nRounds, nRows, nColumns, wordSize,
              nKeyColumns):
     super(RindaelTest, self).__init__()
     print("nRounds = %d, nRows = %d, nColumns = %d, wordSize = %d, "
           "nKeyColumns = %d"
           % (nRounds, nRows, nColumns, wordSize, nKeyColumns))
     self._nRounds = nRounds
     self._nRows = nRows
     self._nColumns = nColumns
     self._wordSize = wordSize
     self._nKeyColumns = nKeyColumns
     self._blockSize = nRows*nColumns*wordSize
     self._keySize = nRows*nKeyColumns*wordSize
     self._key = 0
     self._keyExpansionObj = _KeyExpansion(self._key, self._nRounds, 
                                           self._nRows, self._nColumns, 
                                           self._wordSize,
                                           self._nKeyColumns,
                                           loglevel=logLevel)
     self._subBytesObj = _SubBytes(self._wordSize, loglevel=logLevel)
     self._shiftRowsObj = _ShiftRows(self._nRows, loglevel=logLevel)
     self._mixColumnsObj = _MixColumns(self._nRows, self._nColumns,
                                       self._wordSize, loglevel=logLevel)
     self._addRoundKeyObj = _AddRoundKey(self._nRows, self._nColumns,
                                         self._wordSize, loglevel=logLevel)
     self._round = 0
     self._state = self.int2matrix(0)
     self._bitFlags = 0
 def __init__(self, logLevel, nRounds, nRows, nColumns, wordSize,
              nKeyColumns):
     super(DiffusionTest, self).__init__()
     self._nRounds = nRounds
     self._nRows = nRows
     self._nColumns = nColumns
     self._wordSize = wordSize
     self._nKeyColumns = nKeyColumns
     self._blockSize = nRows * nColumns * wordSize
     self._keySize = nRows * nKeyColumns * wordSize
     self._key = 0
     self._keyExpansionObj = _KeyExpansion(self._key,
                                           self._nRounds,
                                           self._nRows,
                                           self._nColumns,
                                           self._wordSize,
                                           self._nKeyColumns,
                                           loglevel=logLevel)
     self._subBytesObj = _SubBytes(self._wordSize, loglevel=logLevel)
     self._shiftRowsObj = _ShiftRows(self._nRows, loglevel=logLevel)
     self._mixColumnsObj = _MixColumns(self._nRows,
                                       self._nColumns,
                                       self._wordSize,
                                       loglevel=logLevel)
     self._addRoundKeyObj = _AddRoundKey(self._nRows,
                                         self._nColumns,
                                         self._wordSize,
                                         loglevel=logLevel)
     self.resetStates()
Exemple #3
0
 def __init__(self):
     key = aes256['key']
     if key != key2int(int2key(key)):
         raise AssertionError("Failed AES256: key2int")
     self._keyExpansionObj = _KeyExpansion(key, 14, 4, 4, 8, nKeyWords=8)
     self._subBytesObj = _SubBytes(8)  # , sboxCalc=False)
     self._shiftRowsObj = _ShiftRows(4)
     self._mixColumnsObj = _MixColumns(4, 4, 8)
     self._addRoundKeyObj = _AddRoundKey(4, 4, 8)
     input = aes256_round[0]['start']
     self._state = int2matrix(input)
     self._round = 0
     self._Errors = []
Exemple #4
0
 def __init__(self, logLevel, nRounds, nRows, nColumns, wordSize,
              nKeyColumns):
     super(DiffusionTest, self).__init__()
     self._nRounds = nRounds
     self._nRows = nRows
     self._nColumns = nColumns
     self._wordSize = wordSize
     self._nKeyColumns = nKeyColumns
     self._blockSize = nRows*nColumns*wordSize
     self._keySize = nRows*nKeyColumns*wordSize
     self._key = 0
     self._keyExpansionObj = _KeyExpansion(self._key, self._nRounds,
                                           self._nRows, self._nColumns,
                                           self._wordSize,
                                           self._nKeyColumns,
                                           loglevel=logLevel)
     self._subBytesObj = _SubBytes(self._wordSize, loglevel=logLevel)
     self._shiftRowsObj = _ShiftRows(self._nRows, loglevel=logLevel)
     self._mixColumnsObj = _MixColumns(self._nRows, self._nColumns,
                                       self._wordSize, loglevel=logLevel)
     self._addRoundKeyObj = _AddRoundKey(self._nRows, self._nColumns,
                                         self._wordSize, loglevel=logLevel)
     self.resetStates()