def testRotatingKey(self): plain_text = "Burning 'em, if you ain't quick and nimble\nI go crazy when I hear a cymbal" key = expand_rotating_key("ICE", len(plain_text)) ciphertext = hex_encode(xor_fixed_length_buffers(plain_text, key))[0] self.assertEqual(ciphertext, "0b3637272a2b2e63622c2e69692a23693a2a3c6324202d623d63343c2a26226324272765272a282b2f20430a652e2c652a3124333a653e2b2027630c692b20283165286326302e27282f")
def testXorBuffers(self): self.assertEqual( "746865206b696420646f6e277420706c6179", hex_encode(xor_fixed_length_buffers( hex_decode("1c0111001f010100061a024b53535009181c")[0], hex_decode("686974207468652062756c6c277320657965")[0] ))[0] )