#!/usr/bin/env python3

from libpals.util import xor_find_singlechar_key

def test_xor_find_singlechar_key():
    input = '1b37373331363f78151b7f2b783431333d78397828372d363c78373e783a393b3736'
    ciphertext = bytes.fromhex(input)
    result = xor_find_singlechar_key(ciphertext)
    assert result['key']  == 88
    assert result['plaintext']  == b"Cooking MC's like a pound of bacon"

@@ -65,16 +65,34 @@
 char_key
+, hamming_distance
 %0A%0Adef te
@@ -396,8 +396,111 @@
  bacon%22%0A
+%0A%0Adef test_hamming_distance():%0A    assert hamming_distance(b%22this is a test%22, b%22wokka wokka!!!%22) == 37%0A

Add a test for hamming_distance()