feistel 0.1.0

Generic Feistel Cipher
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
/// Hash function for a specific round. Usually depends on a key.
pub trait Round<R> {
    /// Type of the left half of the block.
    type L;
    /// Inspect the right half to generate a value to be xored with the left half.
    fn run(self, right: &R) -> Self::L;
}

impl<L, R, F: FnOnce(&L) -> R> Round<L> for F {
    type L = R;

    fn run(self, right: &L) -> Self::L {
        self(right)
    }
}