fork(239) download
  1. def sxor(s1,s2):
  2. # convert strings to a list of character pair tuples
  3. # go through each tuple, converting them to ASCII code (ord)
  4. # perform exclusive or on the ASCII code
  5. # then convert the result back to ASCII (chr)
  6. # merge the resulting array of characters as a string
  7. return ''.join(chr(ord(a) ^ ord(b)) for a,b in zip(s1,s2))
  8.  
  9. print repr(sxor('Hello', 'world'))
Success #stdin #stdout 0.08s 8832KB
stdin
Standard input is empty
stdout
'?\n\x1e\x00\x0b'