## Fixed xor

Write a function that takes two hex strings as input and XORs them against each other. If the strings are different lengths the output should be the length of the shortest string.

Hint: The strings would first need to be converted to binary to be XOR'd. 

## Note:
If the two strings are of different lengths, the output string should be the same length as the smallest string. This means that the longer string will be cut down to the same size as the smaller string, then xor'd

### Further help

More information on the XOR operation can be found here https://www.khanacademy.org/computing/computer-science/cryptography/ciphers/a/xor-bitwise-operation

More information of the binary and hex bases can be found here https://www.khanacademy.org/math/algebra-home/alg-intro-to-algebra/algebra-alternate-number-bases/v/number-systems-introduction

Examples:

```python
fixed_xor("ab3f", "ac") == "07"
fixed_xor("aadf", "bce2") == "163d"
fixed_xor("1c0111001f010100061a024b53535009181c", "686974207468652062756c6c277320657965") == "746865206b696420646f6e277420706c6179"
```

Source: codewars | Difficulty: EASY
Tags: Matrices

Bit manipulation

Mathematics

Starter code: def fixed_xor(a, b):
	

Solutions:
def fixed_xor(a, b):
	return ''.join((f'{int(x, 16) ^ int(y, 16):x}' for (x, y) in zip(a, b)))


def fixed_xor(a, b):
	m = min(len(a), len(b))
	return f'{int(a[:m], 16) ^ int(b[:m], 16):0{m}x}' if m else ''


def fixed_xor(a, b):
	l = min(len(a), len(b))
	r = '' if not a[:l] else hex(int(a[:l], 16) ^ int(b[:l], 16))[2:]
	return '0' * (l - len(r)) + r


def fixed_xor(a, b):
	if not a or not b:
		return ''
	m1 = min(len(a), len(b))
	(a, b) = (bin(int(a[:m1], 16))[2:], bin(int(b[:m1], 16))[2:])
	m = max(len(a), len(b))
	return hex(int(''.join([str(int(i) ^ int(j)) for (i, j) in zip(a.zfill(m), b.zfill(m))]), 2))[2:].zfill(m1)


def fixed_xor(a, b):
	l = min(len(a), len(b))
	if not l:
		return ''
	(a, b) = (int(a[:l], 16), int(b[:l], 16))
	return hex(a ^ b)[2:].rjust(l, '0')


def fixed_xor(a, b):
	return ''.join(list(map(lambda x: format(int(x[0], 16) ^ int(x[1], 16), 'x'), zip(a, b))))


def fixed_xor(a, b):
	if a == '' or b == '':
		return ''
	m = min(len(a), len(b))
	ha = int(a[:m], 16)
	hb = int(b[:m], 16)
	return hex(ha ^ hb)[2:].zfill(m)