use super::{Decode, Encode, Variant};
pub struct Base64Url;
impl Variant for Base64Url {
const PADDED: bool = true;
const BASE: u8 = b'A';
const DECODER: &'static [Decode] = DECODER;
const ENCODER: &'static [Encode] = ENCODER;
}
pub struct Base64UrlUnpadded;
impl Variant for Base64UrlUnpadded {
const PADDED: bool = false;
const BASE: u8 = b'A';
const DECODER: &'static [Decode] = DECODER;
const ENCODER: &'static [Encode] = ENCODER;
}
const DECODER: &[Decode] = &[
Decode::Range(b'A'..b'Z', -64),
Decode::Range(b'a'..b'z', -70),
Decode::Range(b'0'..b'9', 5),
Decode::Eq(b'-', 63),
Decode::Eq(b'_', 64),
];
const ENCODER: &[Encode] = &[
Encode::Diff(25, 6),
Encode::Diff(51, -75),
Encode::Diff(61, -(b'-' as i16 - 0x20)),
Encode::Diff(62, b'_' as i16 - b'-' as i16 - 1),
];