There are couple things to fix. Main one, when you declare variable as:
m = 1101101
it means m is equal to 1 milion, 101 tousands, 101.
You should write it like this:
m = 0b1101101
or
m = 109
or
m = 0x6D
or even better, to not check or remember binary represetnation you just could write:
m = ord("m")
Now we have valid m letter value. Python does not have built-in byte xor operation, but it's pretty easy to write.
def XOR(char1: int, char2: int) -> int:
return char1 ^ char2
Let's declare m, a, calculate XOR and print it:
m = 0b1101101
a = 0b1100001
xor = XOR(m, a)
print(f"m= {'{0:08b}'.format(m)}\na= {'{0:08b}'.format(a)}\naXORm= {'{0:08b}'.format(xor)}")
Console will return something like that:
m= 01101101
a= 01100001
aXORm= 00001100
Now the last thing is to iterate over "maru" string. It can be done like that:
string_to_xor = "maru"
xor_of_string = ord(string_to_xor[0])
for i in range(len(string_to_xor)-1):
print(f"{chr(xor_of_string)} ({bin(xor_of_string)}) XOR {string_to_xor[i+1]} ({bin(ord(string_to_xor[i+1]))}) is:")
xor_of_string = XOR(xor_of_string, ord(string_to_xor[i+1]))
print('{0:08b}'.format(xor_of_string))
Xor after each letter will be printed. Last one is ascii value of each letter XORed in binary format.
Console output:
m (0b1101101) XOR a (0b1100001) is:
00001100
(0b1100) XOR r (0b1110010) is:
01111110
~ (0b1111110) XOR u (0b1110101) is:
00001011