and replace reduce() with sum
This commit is contained in:
@@ -111,12 +111,10 @@ def do_test(key_matrix):
|
|||||||
output_human_readable(snk_ksv, snk_key, True)
|
output_human_readable(snk_ksv, snk_key, True)
|
||||||
|
|
||||||
# add sink keys together according to src ksv
|
# add sink keys together according to src ksv
|
||||||
key1 = reduce(lambda x, y: (x+y) & 0xffffffffffffff,
|
key1 = sum( x[1] for x in zip(range(40), snk_key) if src_ksv & (1<<x[0]) ) & 0xffffffffffffff
|
||||||
( x[1] for x in zip(range(40), snk_key) if src_ksv & (1<<x[0]) ))
|
|
||||||
|
|
||||||
# add source keys together according to sink ksv
|
# add source keys together according to sink ksv
|
||||||
key2 = reduce(lambda x, y: (x+y) & 0xffffffffffffff,
|
key2 = sum( x[1] for x in zip(range(40), src_key) if snk_ksv & (1<<x[0]) ) & 0xffffffffffffff
|
||||||
( x[1] for x in zip(range(40), src_key) if snk_ksv & (1<<x[0]) ))
|
|
||||||
|
|
||||||
print('\nGenerated keys: sink = %014x, source = %014x' % (key1, key2))
|
print('\nGenerated keys: sink = %014x, source = %014x' % (key1, key2))
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user