Message264323
@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] |
|
Date |
User |
Action |
Args |
2016-04-26 18:35:04 | cowlicks | set | recipients:
+ cowlicks, gvanrossum, georg.brandl, rhettinger, terry.reedy, gregory.p.smith, pitrou, vstinner, christian.heimes, socketpair, Ramchandra Apte, martin.panter, serhiy.storchaka, abarnert, josh.r |
2016-04-26 18:35:04 | cowlicks | set | messageid: <1461695704.5.0.395120188604.issue19251@psf.upfronthosting.co.za> |
2016-04-26 18:35:04 | cowlicks | link | issue19251 messages |
2016-04-26 18:35:04 | cowlicks | create | |
|