Be concise.
Be useful.
All contributions dictatorially edited by webmasters to match personal tastes.
Please do not paste any copyright violating material.
Please try to avoid dependencies to third-party libraries and frameworks.
sub xor_crypt {
my ($b, $k) = @_;
return $b ^ $k;
}
def xor_string(str, key)
ords = key.chars.map(&:ord).cycle
str.chars.zip(ords).inject(""){|res, (c,o)| res << (c.ord ^ o) }
end
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()
}