title: XORing file with multi-byte key
body: <p>I'm simply trying to XOR a file with a multi-byte key. The key may vary in length. Returning the following error:</p>
  
  <pre><code>TypeError: ord() expected string of length 1, but int found
  </code></pre>
  
  <p>Here is what I'm working with right now. </p>
  
  <pre><code>def xor(data, key):
      l = len(key)
  
      decoded = ""
      for i in range(0, len(data)):
          decoded += chr(ord(data[i]) ^ ord(key[i % l]))
      return decoded
  
  data = bytearray(open('myfile.bin', 'rb').read())
  
  key = '\x2a\x2b\x2c\x5e\x25\x44'
  a = xor(data, key)
  print a
  </code></pre>
  
  <p>I know I'm missing something simple but can't place it. </p>