aienux
Aienux, the AienOS kernel: boot, scheduling, IPC and capability boundaries. Pre-alpha; host, emulator and physical evidence are labelled separately.
Brought by drakestapleton
aienux / vendor / base64ct / src / alphabet / bcrypt.rs
| 1 | //! bcrypt Base64 encoding. |
| 2 | |
| 3 | use super::{Alphabet, DecodeStep, EncodeStep}; |
| 4 | |
| 5 | /// bcrypt Base64 encoding. |
| 6 | /// |
| 7 | /// ```text |
| 8 | /// ./ [A-Z] [a-z] [0-9] |
| 9 | /// 0x2e-0x2f, 0x41-0x5a, 0x61-0x7a, 0x30-0x39 |
| 10 | /// ``` |
| 11 | #[derive(Clone, Copy, Debug, Default, Eq, Hash, Ord, PartialEq, PartialOrd)] |
| 12 | pub struct Base64Bcrypt; |
| 13 | |
| 14 | impl Alphabet for Base64Bcrypt { |
| 15 | const BASE: u8 = b'.'; |
| 16 | |
| 17 | const DECODER: &'static [DecodeStep] = &[ |
| 18 | DecodeStep::Range(b'.'..=b'/', -45), |
| 19 | DecodeStep::Range(b'A'..=b'Z', -62), |
| 20 | DecodeStep::Range(b'a'..=b'z', -68), |
| 21 | DecodeStep::Range(b'0'..=b'9', 7), |
| 22 | ]; |
| 23 | |
| 24 | const ENCODER: &'static [EncodeStep] = &[ |
| 25 | EncodeStep::Apply(b'/', 17), |
| 26 | EncodeStep::Apply(b'Z', 6), |
| 27 | EncodeStep::Apply(b'z', -75), |
| 28 | ]; |
| 29 | |
| 30 | const PADDED: bool = false; |
| 31 | |
| 32 | type Unpadded = Self; |
| 33 | } |