crypto/algorithms/pureaescipher.py
def _expandKey(self, key, size, expandedKeySize):
        '''
        Rijndael's key expansion

        Expands an 128,192,256 key into an 176,208,240 bytes key

        expandedKey is a char list of large enough size,
        key is the non-expanded key.
        '''
        # current expanded keySize, in bytes
        currentSize = 0
        rconIteration = 1
        expandedKey = [0] * expandedKeySize

        # set the 16, 24, 32 bytes of the expanded key to the input key
        for j in range(size):
            expandedKey[j] = key[j]
        currentSize += size

        while currentSize < expandedKeySize:
            # assign the previous 4 bytes to the temporary value t
            t = expandedKey[currentSize-4:currentSize]

            # every 16,24,32 bytes we apply the core schedule to t
            # and increment rconIteration afterwards
            if currentSize % size == 0:
                t = self._core(t, rconIteration)
                rconIteration += 1
            # For 256-bit keys, we add an extra sbox to the calculation
            if size == self.keySize["SIZE_256"] and ((currentSize % size) == 16):
                for l in range(4): t[l] = self._getSBoxValue(t[l])

            # We XOR t with the four-byte block 16,24,32 bytes before the new
            # expanded key.  This becomes the next four bytes in the expanded
            # key.
            for m in range(4):
                expandedKey[currentSize] = expandedKey[currentSize - size] ^ \
                        t[m]
                currentSize += 1

        return expandedKey

        Rijndael's key expansion

        Expands an 128,192,256 key into an 176,208,240 bytes key

        expandedKey is a char list of large enough size,
        key is the non-expanded key.
        
Rijndael's key expansion
Expands an 128,192,256 key into an 176,208,240 bytes key

expandedKey is a char list of large enough size,
key is the non-expanded key.
Rijndael ' s key expansion Expands an 128 192 256 key into an 176 208 240 bytes key expandedKey is a char list of large enough size key is the non - expanded key .
def _expandKey(self, key, size, expandedKeySize):
        currentSize = 0
        rconIteration = 1
        expandedKey = [0] * expandedKeySize
        for j in range(size):
            expandedKey[j] = key[j]
        currentSize += size
        while currentSize < expandedKeySize:
            t = expandedKey[currentSize-4:currentSize]
            if currentSize % size == 0:
                t = self._core(t, rconIteration)
                rconIteration += 1
            if size == self.keySize["SIZE_256"] and ((currentSize % size) == 16):
                for l in range(4): t[l] = self._getSBoxValue(t[l])
            for m in range(4):
                expandedKey[currentSize] = expandedKey[currentSize - size] ^ \
                        t[m]
                currentSize += 1
        return expandedKey
def _expandKey ( self , key , size , expandedKeySize ) : currentSize = 0 rconIteration = 1 expandedKey = [ 0 ] * expandedKeySize for j in range ( size ) : expandedKey [ j ] = key [ j ] currentSize += size while currentSize < expandedKeySize : t = expandedKey [ currentSize - 4 : currentSize ] if currentSize % size == 0 : t = self . _core ( t , rconIteration ) rconIteration += 1 if size == self . keySize [ "SIZE_256" ] and ( ( currentSize % size ) == 16 ) : for l in range ( 4 ) : t [ l ] = self . _getSBoxValue ( t [ l ] ) for m in range ( 4 ) : expandedKey [ currentSize ] = expandedKey [ currentSize - size ] ^ t [ m ] currentSize += 1 return expandedKey
Rijndael's key expansion
Expands an 128,192,256 key into an 176,208,240 bytes key
Rijndael ' s key expansion Expands an 128 192 256 key into an 176 208 240 bytes key
'''
        Rijndael's key expansion

        Expands an 128,192,256 key into an 176,208,240 bytes key

        expandedKey is a char list of large enough size,
        key is the non-expanded key.
        ''' # current expanded keySize, in bytes # set the 16, 24, 32 bytes of the expanded key to the input key # assign the previous 4 bytes to the temporary value t # every 16,24,32 bytes we apply the core schedule to t # and increment rconIteration afterwards # For 256-bit keys, we add an extra sbox to the calculation # We XOR t with the four-byte block 16,24,32 bytes before the new # expanded key.  This becomes the next four bytes in the expanded # key.
self
key
size
expandedKeySize