diff --git a/04_qkd_2.py b/04_qkd_2.py index 79fd990..a400a88 100644 --- a/04_qkd_2.py +++ b/04_qkd_2.py @@ -96,7 +96,14 @@ def encrypt_message(message, otp): return # XOR the message to be sent - return [m_b ^ otp_b for m_b, otp_b in zip(binary_message, otp)] + encrypted_message = [m_b ^ otp_b for m_b, otp_b in zip(binary_message, otp)] + if DEBUG: + print("Bin msg: {}".format(binary_message)) + print("OTP: {}".format(otp)) + print("Enc: {}".format(encrypted_message)) + print("Alice sends Enc") + + return encrypted_message def decrypt_message(encrypted_bits, otp): @@ -109,8 +116,15 @@ def decrypt_message(encrypted_bits, otp): """ _decrypted_bits = [m_b ^ otp_b for m_b, otp_b in zip(encrypted_bits, otp)] + _decrypted_msg = binary_to_unicode_message(_decrypted_bits) - return binary_to_unicode_message(_decrypted_bits) + if DEBUG: + print("Bob receives Enc") + print("Enc: {}".format(encrypted_bits)) + print("OTP: {}".format(otp)) + print("Bin msg: {}".format(_decrypted_bits)) + + return _decrypted_msg def run_qbit_tests():