diff -r 4f2dd0850803 -r b047181a4a33 Utilities/crypto/py3AES.py --- a/Utilities/crypto/py3AES.py Sat Mar 11 14:35:22 2017 +0100 +++ b/Utilities/crypto/py3AES.py Sat Mar 11 18:08:42 2017 +0100 @@ -608,11 +608,11 @@ "CBC": 2, } - def __extractBytes(self, input, start, end, mode): + def __extractBytes(self, inputData, start, end, mode): """ Private method to extract a range of bytes from the input. - @param input input data (bytes) + @param inputData input data (bytes) @param start start index (integer) @param end end index (integer) @param mode mode of operation (0, 1, 2) @@ -630,21 +630,21 @@ while len(ar) < end - start: ar.append(0) while i < end: - ar[j] = input[i] + ar[j] = inputData[i] j += 1 i += 1 return ar - def encrypt(self, input, mode, key, size, IV): + def encrypt(self, inputData, mode, key, size, IV): """ Public method to perform the encryption operation. - @param input data to be encrypted (bytes) + @param inputData data to be encrypted (bytes) @param mode mode of operation (0, 1 or 2) @param key key to be used (bytes) @param size length of the key (16, 24 or 32) @param IV initialisation vector (bytearray) - @return tuple with mode of operation, length of the input and + @return tuple with mode of operation, length of the input data and the encrypted data (integer, integer, bytes) @exception ValueError key size is invalid or decrypted data is invalid """ @@ -661,13 +661,13 @@ cipherOut = bytearray() # char firstRound firstRound = True - if input: - for j in range(int(math.ceil(float(len(input)) / 16))): + if inputData: + for j in range(int(math.ceil(float(len(inputData)) / 16))): start = j * 16 end = j * 16 + 16 - if end > len(input): - end = len(input) - plaintext = self.__extractBytes(input, start, end, mode) + if end > len(inputData): + end = len(inputData) + plaintext = self.__extractBytes(inputData, start, end, mode) if mode == self.ModeOfOperation["CFB"]: if firstRound: output = self.aes.encrypt(IV, key, size) @@ -715,7 +715,7 @@ # always 16 bytes because of the padding for CBC for k in range(16): cipherOut.append(ciphertext[k]) - return mode, len(input), bytes(cipherOut) + return mode, len(inputData), bytes(cipherOut) # Mode of Operation Decryption # cipherIn - Encrypted String