actually, I'm missing a very important part of the algorithm (sorry!)
the correct one is:
result = ((m-k) XOR k) + k) XOR previous_unencrypted_m
where the previous unencrypted m makes it an asymmetrical algorithm, needing a 1-byte initialization vector (possibly derived somehow from the passphrase that generates k)
and this is mostly for challenging myself and my abilities, but I may use it to scramble variables in a data file...