eric6/Utilities/crypto/py3AES.py

changeset 8235
78e6d29eb773
parent 8220
006ee31b4835
--- a/eric6/Utilities/crypto/py3AES.py	Tue Apr 13 18:02:59 2021 +0200
+++ b/eric6/Utilities/crypto/py3AES.py	Tue Apr 13 19:59:17 2021 +0200
@@ -312,10 +312,7 @@
         @return modified state (bytearray)
         """
         state = state[:]
-        if isInv:
-            getter = self.__getSBoxInvert
-        else:
-            getter = self.__getSBoxValue
+        getter = self.__getSBoxInvert if isInv else self.__getSBoxValue
         for i in range(16):
             state[i] = getter(state[i])
         return state
@@ -389,10 +386,7 @@
         @return modified column (bytearray)
         """
         column = column[:]
-        if isInv:
-            mult = [14, 9, 13, 11]
-        else:
-            mult = [2, 1, 1, 3]
+        mult = [14, 9, 13, 11] if isInv else [2, 1, 1, 3]
         cpy = column[:]
         g = self.__galois_multiplication
 
@@ -634,10 +628,8 @@
         """
         if end - start > 16:
             end = start + 16
-        if mode == self.ModeOfOperation["CBC"]:
-            ar = bytearray(16)
-        else:
-            ar = bytearray()
+        ar = (bytearray(16) if mode == self.ModeOfOperation["CBC"]
+              else bytearray())
 
         i = start
         j = 0

eric ide

mercurial