hanifx 0.1.0

Master-level encoding module for text and files. Safe decode included.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
pub fn encode(input: &str, key: &str) -> String {
    let mut encoded_chars: Vec<char> = input.chars()
        .enumerate()
        .map(|(i, c)| {
            let shift = key.chars().nth(i % key.len()).unwrap_or('a') as u8;
            ((c as u8).wrapping_add(shift)) as char
        })
        .collect();

    encoded_chars.reverse(); // safely reverse
    encoded_chars.into_iter().collect()
}