Pendigard's picture
Upload folder using huggingface_hub (part 105)
8d55ddb verified
Raw History Blame Contribute Delete
838 Bytes
#!/usr/bin/python
# Write a function that takes two equal-length buffers and produces their XOR combination.
#
# If your function works properly, then when you feed it the string:
#
# 1c0111001f010100061a024b53535009181c
# ... after hex decoding, and when XOR'd against:
#
# 686974207468652062756c6c277320657965
#
# ... should produce:
#
# 746865206b696420646f6e277420706c6179
def xThenor(num1,num2):
# Step 1: Are they the same len
if len(num1)!=len(num2):
return "They are not the same length try again BRO!!!!!!"
else:
print("Got it coach numbers look good, now it time to use my trusty decoder ring!")
# Step 2: Hex and XOR the inputed values
return '%x' % (int(num1,16)^int(num2,16))
number1=raw_input("First Number\n> ")
number2=raw_input("Second Number\n> ")
x = xThenor(number1,number2)
print x