Create a function that XOR encrypts/decrypts a string
def xor_string(str, key) ords = key.chars.map(&:ord).cycle str.chars.zip(ords).inject(""){|res, (c,o)| res << (c.ord ^ o) } end
sysutils
encrypted := xorstring(key, original);
sub xor_crypt { my ($b, $k) = @_; return $b ^ $k; }
from itertools import cycle
def xor(data, key): return ''.join(chr(ord(x)^ord(y)) for x,y in zip(data, cycle(key)))
fn xor(s: Vec<u8>, key: &[u8]) -> Vec<u8> { let mut b = key.iter().cycle(); s.into_iter().map(|x| x ^ b.next().unwrap()).collect() }
No security, no password. Other people might choose the same nickname.