eme2 0.1.3

EME2 (ECB-Mask-ECB) wide-block cipher mode of operation
Documentation
use cipher::KeyIvInit;
use eme2::Eme2;
use serpent::Serpent;

type SerpentEme2 = Eme2<Serpent>;

#[test]
fn test_serpent_compatibility() {
    let key = [0x42; 16];
    let tweak = [0x11; 16];
    
    let mut plaintext = vec![0u8; 64];
    for i in 0..64 {
        plaintext[i] = (i % 256) as u8;
    }

    let mut buf = plaintext.clone();
    
    let cipher = SerpentEme2::new(&key.into(), &tweak.into());
    cipher.encrypt(&mut buf).unwrap();
    
    assert_ne!(buf, plaintext);
    assert_eq!(buf.len(), plaintext.len());

    cipher.decrypt(&mut buf).unwrap();
    assert_eq!(buf, plaintext);
}