File size: 838 Bytes
8d55ddb
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#!/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