Skip to main content

atbash_bytes

Function atbash_bytes 

Source
pub fn atbash_bytes(bytes: &[u8]) -> Vec<u8> 
Expand description

Applies the Atbash cipher to a raw byte slice, substituting only ASCII letters.

Suitable for binary data where only the letter bytes should be substituted. Non-letter bytes are passed through unchanged. Applying this function twice to the same input returns the original bytes.

§Examples

use rune_atbash::atbash_bytes;

assert_eq!(atbash_bytes(b"Hello!"), b"Svool!");
assert_eq!(atbash_bytes(b"Svool!"), b"Hello!");
assert_eq!(atbash_bytes(b"\x00\xff"), b"\x00\xff");
assert_eq!(atbash_bytes(b""), b"");