[ENGLISH] Capture the Flag at UCF - Write Up - Crypto - XORLY
![Bild](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjH-HgCshbonHQ4hP6Qo6mxm258FWDoHZ2fmU6Gl99Sw8HZYmwasIuXuNHAmAca3RVD_ITTSUIQxkhHdHHq7d7lB30P8l97lZSDr9foGov9Eo8dGzGUk_WtbP5ahpqKL0pZrKYZ4pm-J0A-/s640/Tool.png)
With in this blog post, we are going to solve the xorly.py challenge available at: https://ctf.hackucf.org/challenges#xorly Below you find the challenge we have to solve. #!/usr/bin/env python2 def encrypt(plaintext, key): ciphertext = [] for i in xrange(0, len(plaintext)): ciphertext.append(ord(plaintext[i]) ^ ord(key[i%len(key)])) return ''.join(map(chr, ciphertext)) decrypt = encrypt ''' I'll give you a sample of how this works: Plaintext: "Here is a sample. Pay close attention!" Ciphertext: (encoded in hex) 2e0c010d46000048074900090b191f0d484923091f491004091a1648071d070d081d1a070848 Flag: (encoded in hex, encrypted with the same key) 0005120f1d111c1a3900003712011637080c0437070c0015 ''' The source code is written in python2 as you have seen above. The most important part here is where the actual encryption happens. ciphertext.append(ord(plaintext[i]) ^ ord(key[i%len(key)])) In this line, our inp...