MCPcopy Create free account
hub / github.com/echQoQ/RustSL / xor_cipher

Function xor_cipher

rsl-macros/src/lib.rs:175–184  ·  view source on GitHub ↗
(input: &str, key: &str)

Source from the content-addressed store, hash-verified

173}
174
175fn xor_cipher(input: &str, key: &str) -> String {
176 let key_bytes = key.as_bytes();
177 let input_bytes = input.as_bytes();
178 let encrypted: Vec<u8> = input_bytes
179 .iter()
180 .enumerate()
181 .map(|(i, &b)| b ^ key_bytes[i % key_bytes.len()])
182 .collect();
183 general_purpose::STANDARD.encode(&encrypted)
184}

Callers 1

encrypt_stringFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected