MCPcopy Create free account
hub / github.com/TheAlgorithms/Python / xor

Function xor

other/sdes.py:22–33  ·  view source on GitHub ↗

>>> xor("01010101", "00001111") '01011010'

(a, b)

Source from the content-addressed store, hash-verified

20
21
22def xor(a, b):
23 """
24 >>> xor("01010101", "00001111")
25 '01011010'
26 """
27 res = ""
28 for i in range(len(a)):
29 if a[i] == b[i]:
30 res += "0"
31 else:
32 res += "1"
33 return res
34
35
36def apply_sbox(s, data):

Callers 1

functionFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected