base64ct/alphabet/
pbkdf2.rs1use crate::alphabet::{Alphabet, DecodeStep, EncodeStep};
2
3#[derive(Clone, Copy, Debug, Default, Eq, Hash, Ord, PartialEq, PartialOrd)]
10pub struct Base64Pbkdf2;
11
12impl Alphabet for Base64Pbkdf2 {
13 const BASE: u8 = b'A';
14 const DECODER: &'static [DecodeStep] = DECODER;
15 const ENCODER: &'static [EncodeStep] = ENCODER;
16 const PADDED: bool = false;
17 type Unpadded = Self;
18}
19
20const DECODER: &[DecodeStep] = &[
21 DecodeStep::Range(b'A'..=b'Z', -64),
22 DecodeStep::Range(b'a'..=b'z', -70),
23 DecodeStep::Range(b'0'..=b'9', 5),
24 DecodeStep::Eq(b'.', 63),
25 DecodeStep::Eq(b'/', 64),
26];
27
28const ENCODER: &[EncodeStep] = &[
29 EncodeStep::Diff(25, 6),
30 EncodeStep::Diff(51, -75),
31 EncodeStep::Diff(61, -(b'.' as i16 - 0x22)),
32 EncodeStep::Diff(62, b'/' as i16 - b'.' as i16 - 1),
33];