Snippets

Alexander Hanel CryptoPals

Updated by Alexander Hanel

File solutions.md Modified

  • Ignore whitespace
  • Hide word diff
 ```Python
 import base64 
 base64.b64encode("49276d206b696c6c696e6720796f757220627261696e206c696b65206120706f69736f6e6f7573206d757368726f6f6d".decode("hex"))
-```
+```
+### Challenge 2  - Fixed XOR
+```Python
+from itertools import cycle
+
+def xor_mb(message, key):
+    '''Multi-byte XOR of a string message and string key'''
+    return''.join(chr(ord(m_byte)^ord(k_byte)) for m_byte,k_byte in zip(message, cycle(key)))
+
+xor_mb("1c0111001f010100061a024b53535009181c".decode('hex'), "686974207468652062756c6c277320657965".decode('hex')).encode('hex')
+```
+
+### Challenge 3 - Single-byte XOR cipher
+
Created by Alexander Hanel

File solutions.md Added

  • Ignore whitespace
  • Hide word diff
+## Set 1
+
+### Challenge 1 - Convert hex to base64
+
+```Python
+import base64 
+base64.b64encode("49276d206b696c6c696e6720796f757220627261696e206c696b65206120706f69736f6e6f7573206d757368726f6f6d".decode("hex"))
+```
  1. 1
  2. 2
  3. 3
  4. 4
  5. 5
HTTPS SSH

You can clone a snippet to your computer for local editing. Learn more.