Utilities/crypto/py3AES.py

branch
Py2 comp.
changeset 3060
5883ce99ee12
parent 3058
0a02c433f52d
parent 3039
8dd0165d805d
child 3145
a9de05d4a22f
--- a/Utilities/crypto/py3AES.py	Fri Nov 01 15:48:48 2013 +0100
+++ b/Utilities/crypto/py3AES.py	Sun Nov 03 15:58:22 2013 +0100
@@ -346,12 +346,12 @@
         for i in range(nbr):
             if isInv:
                 state[statePointer:statePointer + 4] = \
-                        state[statePointer + 3:statePointer + 4] + \
-                        state[statePointer:statePointer + 3]
+                    state[statePointer + 3:statePointer + 4] + \
+                    state[statePointer:statePointer + 3]
             else:
                 state[statePointer:statePointer + 4] = \
-                        state[statePointer + 1:statePointer + 4] + \
-                        state[statePointer:statePointer + 1]
+                    state[statePointer + 1:statePointer + 4] + \
+                    state[statePointer:statePointer + 1]
         return state
 
     def __mixColumns(self, state, isInv):
@@ -393,13 +393,13 @@
         g = self.__galois_multiplication
 
         column[0] = g(cpy[0], mult[0]) ^ g(cpy[3], mult[1]) ^ \
-                    g(cpy[2], mult[2]) ^ g(cpy[1], mult[3])
+            g(cpy[2], mult[2]) ^ g(cpy[1], mult[3])
         column[1] = g(cpy[1], mult[0]) ^ g(cpy[0], mult[1]) ^ \
-                    g(cpy[3], mult[2]) ^ g(cpy[2], mult[3])
+            g(cpy[3], mult[2]) ^ g(cpy[2], mult[3])
         column[2] = g(cpy[2], mult[0]) ^ g(cpy[1], mult[1]) ^ \
-                    g(cpy[0], mult[2]) ^ g(cpy[3], mult[3])
+            g(cpy[0], mult[2]) ^ g(cpy[3], mult[3])
         column[3] = g(cpy[3], mult[0]) ^ g(cpy[2], mult[1]) ^ \
-                    g(cpy[1], mult[2]) ^ g(cpy[0], mult[3])
+            g(cpy[1], mult[2]) ^ g(cpy[0], mult[3])
         return column
 
     def __aes_round(self, state, roundKey):
@@ -664,7 +664,7 @@
             for j in range(int(math.ceil(float(len(input)) / 16))):
                 start = j * 16
                 end = j * 16 + 16
-                if  end > len(input):
+                if end > len(input):
                     end = len(input)
                 plaintext = self.__extractBytes(input, start, end, mode)
                 # print 'PT@%s:%s' % (j, plaintext)
@@ -753,7 +753,7 @@
         bytesOut = bytearray()
         # char firstRound
         firstRound = True
-        if cipherIn != None:
+        if cipherIn is not None:
             for j in range(int(math.ceil(float(len(cipherIn)) / 16))):
                 start = j * 16
                 end = j * 16 + 16

eric ide

mercurial