Wireless Army
This is a blog / tips and tricks website for web developers and security researchers.
follow us in feedly


xor function for binary
by admin
 at 2019-07-26 14:06:00.

binaryA = "11011111101100110110011001011101000"
binaryB = "11001011101100111000011100001100001"
def xor(a,b):
	y = int(a,2) ^ int(b,2)
	return '{0:0{1}b}'.format(y,len(a))

print xor(binaryA,binaryB)
or you can use less code and do this:
binaryA = "11011111101100110110011001011101000"
binaryB = "11001011101100111000011100001100001"
y = ''.join('0' if i == j else '1' for i, j in zip(binaryA,binaryB))
print y