diff options
Diffstat (limited to 'vendor/base64ct/src/alphabet/crypt.rs')
-rw-r--r-- | vendor/base64ct/src/alphabet/crypt.rs | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/vendor/base64ct/src/alphabet/crypt.rs b/vendor/base64ct/src/alphabet/crypt.rs new file mode 100644 index 000000000..5d97c33ac --- /dev/null +++ b/vendor/base64ct/src/alphabet/crypt.rs @@ -0,0 +1,29 @@ +//! `crypt(3)` Base64 encoding. + +use super::{Alphabet, DecodeStep, EncodeStep}; + +/// `crypt(3)` Base64 encoding. +/// +/// ```text +/// [.-9] [A-Z] [a-z] +/// 0x2e-0x39, 0x41-0x5a, 0x61-0x7a +/// ``` +#[derive(Copy, Clone, Debug, Eq, PartialEq)] +pub struct Base64Crypt; + +impl Alphabet for Base64Crypt { + const BASE: u8 = b'.'; + + const DECODER: &'static [DecodeStep] = &[ + DecodeStep::Range(b'.'..=b'9', -45), + DecodeStep::Range(b'A'..=b'Z', -52), + DecodeStep::Range(b'a'..=b'z', -58), + ]; + + const ENCODER: &'static [EncodeStep] = + &[EncodeStep::Apply(b'9', 7), EncodeStep::Apply(b'Z', 6)]; + + const PADDED: bool = false; + + type Unpadded = Self; +} |