cowlicks added the comment:
@gvanrossum in this previous comment
https://bugs.python.org/issue19251?@ok_message=msg%20264184%20created%0Aissue%2019251%20message_count%2C%20messages%20edited%20ok&@template=item#msg257964
I pointed out code from the wild which would be more readable, and posted
preliminary benchmarks. But there is a typo, I should have written:
def __mix_single_column(self, a):
t = len(a) * bytes([reduce(xor, a)])
a ^= t ^ xtime(a ^ (a[1:] + a[0:1]))
As @gregory.p.smith points out, my claim about security isn't very clear. This
would be "more secure" for two reasons. Code would be easier to read and
therefore verify, but this is the same as readability. The other reason, doing
some binary bitwise op on two bytes objects enforces that the objects be the
same length, so unexpected bugs in these code samples would be avoided.
bytes(x ^ y for x, y in zip(a, b))
(int.from_bytes(a, 'big') ^ int.from_bytes(b, 'big')).to_bytes(len(a), 'big')
# XOR each byte of the roundKey with the state table
def addRoundKey(state, roundKey):
for i in range(len(state)):
state[i] = state[i] ^ roundKey[i]
----------
_______________________________________
Python tracker <[email protected]>
<http://bugs.python.org/issue19251>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com