1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
use generic_array::ArrayLength;
use typenum::uint::Unsigned;
pub mod blowfish;
pub trait BlockEncrypt {
type BlockSize: Unsigned + ArrayLength<u8>;
fn block_size() -> usize {
Self::BlockSize::to_usize()
}
fn encrypt_block<I, O>(&self, input: I, output: O)
where I: AsRef<[u8]>,
O: AsMut<[u8]>;
}
pub trait BlockDecrypt {
type BlockSize: Unsigned + ArrayLength<u8>;
fn block_size() -> usize {
Self::BlockSize::to_usize()
}
fn decrypt_block<I, O>(&self, input: I, output: O)
where I: AsRef<[u8]>,
O: AsMut<[u8]>;
}