Skip to content

Instantly share code, notes, and snippets.

@nmcv
Created February 4, 2014 11:58
Show Gist options
  • Save nmcv/8802373 to your computer and use it in GitHub Desktop.
Save nmcv/8802373 to your computer and use it in GitHub Desktop.
Coursera/Crypto009 (Feb 2014) Homework 2, Question 4
# crypto009, homework 2, question 4
# Lefts
l1_0 = "9d1a4f78" # 0^64
l1_1 = "75e5e3ea" # 1^32,0^32
l2_0 = "5f67abaf" # ditto
l2_1 = "bbe033c0"
l3_0 = "4af53267" # ditto
l3_1 = "87a40cfa"
l4_0 = "9f970f4e" # ditto
l4_1 = "6068f0b1"
# Just check visually
[hex(item) for item in [a^b for a,b in zip([ord(c) for c in l1_1.decode('hex')], [0xFF] * 4)]]
[hex(item) for item in [a^b for a,b in zip([ord(c) for c in l2_1.decode('hex')], [0xFF] * 4)]]
[hex(item) for item in [a^b for a,b in zip([ord(c) for c in l3_1.decode('hex')], [0xFF] * 4)]]
# Bang! F(k2, *) ⊕ 1 of 1^32, 0^32 = F(k2, *) of 0^64
# i.e ['0x9f', '0x97', '0xf', '0x4e'] is l4_0
[hex(item) for item in [a^b for a,b in zip([ord(c) for c in l4_1.decode('hex')], [0xFF] * 4)]]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment