### Utilities/crypto/py3AES.py

changeset 6188
5a6ae3be31e6
parent 6048
child 6645
equal inserted replaced
6187:2cc7e3629784 6188:5a6ae3be31e6
287 @param a first factor (byte) 287 @param a first factor (byte)
288 @param b second factor (byte) 288 @param b second factor (byte)
289 @return result (byte) 289 @return result (byte)
290 """ 290 """
291 p = 0 291 p = 0
292 for counter in range(8): 292 for _counter in range(8):
293 if b & 1: 293 if b & 1:
294 p ^= a 294 p ^= a
295 hi_bit_set = a & 0x80 295 hi_bit_set = a & 0x80
296 a <<= 1 296 a <<= 1
297 # keep a 8 bit 297 # keep a 8 bit
342 @param nbr number of positions to shift (integer) 342 @param nbr number of positions to shift (integer)
343 @param isInv flag indicating an inverse operation (boolean) 343 @param isInv flag indicating an inverse operation (boolean)
344 @return modified state (bytearray) 344 @return modified state (bytearray)
345 """ 345 """
346 state = state[:] 346 state = state[:]
347 for i in range(nbr): 347 for _ in range(nbr):
348 if isInv: 348 if isInv:
349 state[statePointer:statePointer + 4] = \ 349 state[statePointer:statePointer + 4] = \
350 state[statePointer + 3:statePointer + 4] + \ 350 state[statePointer + 3:statePointer + 4] + \
351 state[statePointer:statePointer + 3] 351 state[statePointer:statePointer + 3]
352 else: 352 else: