hapi_iron_oxide/
algorithm.rs

1#[derive(Clone, Copy, Debug, PartialEq)]
2pub enum Algorithm {
3    Aes128Ctr,
4    Aes256Cbc,
5    Sha256,
6}
7
8impl Algorithm {
9    pub fn name(self: &Self) -> String {
10        match self {
11            &Self::Aes256Cbc => "AES-CBC".to_owned(),
12            &Self::Aes128Ctr => "AES-CTR".to_owned(),
13            &Self::Sha256 => "SHA-256".to_owned(),
14        }
15    }
16
17    pub const fn key_bits(self: &Self) -> usize {
18        match self {
19            &Self::Aes256Cbc => 32,
20            &Self::Aes128Ctr => 16,
21            &Self::Sha256 => 32,
22        }
23    }
24}