#![doc = ""]
#![doc = include_str!("../README.md")]
#![no_std]
#![cfg_attr(docsrs, feature(doc_auto_cfg))]
#[cfg(feature = "alloc")]
extern crate alloc;
#[cfg(feature = "std")]
extern crate std;
#[cfg(feature = "alloc")]
use alloc::borrow::{Cow, ToOwned};
#[cfg(feature = "alloc")]
use alloc::string::String;
#[cfg(feature = "alloc")]
use alloc::vec;
#[cfg(feature = "alloc")]
use alloc::vec::Vec;
use core::convert::TryInto;
use core::marker::PhantomData;
use core::mem::MaybeUninit;
macro_rules! check {
($e: expr, $c: expr) => {
if !$c {
return Err($e);
}
};
}
pub trait BitWidth: sealed::BitWidth {}
pub trait Bool: sealed::Bool {}
mod sealed {
pub trait BitWidth {
const VAL: usize;
}
pub trait Bool {
type If<Then: Copy, Else: Copy>: Copy;
const VAL: bool;
fn open<Then: Copy, Else: Copy>(cond: Self::If<Then, Else>) -> If<Then, Else>;
fn make<Then: Copy, Else: Copy>(
then: impl FnOnce() -> Then, else_: impl FnOnce() -> Else,
) -> Self::If<Then, Else>;
}
#[derive(Debug, Copy, Clone)]
pub enum If<Then, Else> {
Then(Then),
Else(Else),
}
}
use sealed::If;
macro_rules! new_bit_width {
($(($N:ident, $v:expr, $b:literal),)*) => {
$(
#[doc = concat!(" Bit-width of ", $b, " encodings.")]
#[derive(Debug)]
pub enum $N {}
impl BitWidth for $N {}
impl sealed::BitWidth for $N { const VAL: usize = $v; }
)*
};
}
new_bit_width![
(Bit1, 1, "base2"),
(Bit2, 2, "base4"),
(Bit3, 3, "base8"),
(Bit4, 4, "base16"),
(Bit5, 5, "base32"),
(Bit6, 6, "base64"),
];
#[derive(Debug)]
pub enum False {}
impl Bool for False {}
impl sealed::Bool for False {
type If<Then: Copy, Else: Copy> = Else;
const VAL: bool = false;
fn open<Then: Copy, Else: Copy>(cond: Self::If<Then, Else>) -> If<Then, Else> {
If::Else(cond)
}
fn make<Then: Copy, Else: Copy>(
_then: impl FnOnce() -> Then, else_: impl FnOnce() -> Else,
) -> Self::If<Then, Else> {
else_()
}
}
#[derive(Debug, Copy, Clone)]
pub enum True {}
impl Bool for True {}
impl sealed::Bool for True {
type If<Then: Copy, Else: Copy> = Then;
const VAL: bool = true;
fn open<Then: Copy, Else: Copy>(cond: Self::If<Then, Else>) -> If<Then, Else> {
If::Then(cond)
}
fn make<Then: Copy, Else: Copy>(
then: impl FnOnce() -> Then, _else: impl FnOnce() -> Else,
) -> Self::If<Then, Else> {
then()
}
}
unsafe fn cast<Bit: BitWidth, Msb: Bool, Pad: Bool, Wrap: Bool, Ignore: Bool>(
base: &DynEncoding,
) -> &Encoding<Bit, Msb, Pad, Wrap, Ignore> {
let ptr = core::ptr::from_ref(base).cast::<Encoding<Bit, Msb, Pad, Wrap, Ignore>>();
unsafe { &*ptr }
}
macro_rules! dispatch {
($dyn:ident $($body: tt)*) => {
dispatch!([] Bit $dyn $($body)*)
};
([] Bit $dyn:ident $($body:tt)*) => {
match $dyn.bit() {
1 => dispatch!([Bit1] Msb $dyn $($body)*),
2 => dispatch!([Bit2] Msb $dyn $($body)*),
3 => dispatch!([Bit3] Msb $dyn $($body)*),
4 => dispatch!([Bit4] Msb $dyn $($body)*),
5 => dispatch!([Bit5] Msb $dyn $($body)*),
6 => dispatch!([Bit6] Msb $dyn $($body)*),
_ => unreachable!(),
}
};
([$($gen:ty),*] Msb $dyn:ident $($body:tt)*) => {
match $dyn.msb() {
false => dispatch!([$($gen),*, False] Pad $dyn $($body)*),
true => dispatch!([$($gen),*, True] Pad $dyn $($body)*),
}
};
([$($gen:ty),*] Pad $dyn:ident $($body:tt)*) => {
match $dyn.pad().is_some() {
false => dispatch!([$($gen),*, False] Wrap $dyn $($body)*),
true => dispatch!([$($gen),*, True] Wrap $dyn $($body)*),
}
};
([$($gen:ty),*] Wrap $dyn:ident $($body:tt)*) => {
match $dyn.wrap().is_some() {
false => dispatch!([$($gen),*, False] Ignore $dyn $($body)*),
true => dispatch!([$($gen),*, True] Ignore $dyn $($body)*),
}
};
([$($gen:ty),*] Ignore $dyn:ident $($body:tt)*) => {
match $dyn.has_ignore() {
false => dispatch!({ $($gen),*, False } $dyn $($body)*),
true => dispatch!({ $($gen),*, True } $dyn $($body)*),
}
};
({ $($gen:ty),* } $dyn:ident $($body:tt)*) => {
unsafe { cast::<$($gen),*>($dyn) } $($body)*
};
}
unsafe fn chunk_unchecked<T>(x: &[T], n: usize, i: usize) -> &[T] {
debug_assert!((i + 1) * n <= x.len());
unsafe { core::slice::from_raw_parts(x.as_ptr().add(n * i), n) }
}
unsafe fn chunk_mut_unchecked<T>(x: &mut [T], n: usize, i: usize) -> &mut [T] {
debug_assert!((i + 1) * n <= x.len());
unsafe { core::slice::from_raw_parts_mut(x.as_mut_ptr().add(n * i), n) }
}
unsafe fn copy_from_slice(dst: &mut [MaybeUninit<u8>], src: &[u8]) {
dst.copy_from_slice(unsafe { &*(core::ptr::from_ref(src) as *const [MaybeUninit<u8>]) });
}
unsafe fn slice_assume_init_mut(xs: &mut [MaybeUninit<u8>]) -> &mut [u8] {
unsafe { &mut *(core::ptr::from_mut(xs) as *mut [u8]) }
}
unsafe fn slice_uninit_mut(xs: &mut [u8]) -> &mut [MaybeUninit<u8>] {
unsafe { &mut *(core::ptr::from_mut(xs) as *mut [MaybeUninit<u8>]) }
}
#[cfg(feature = "alloc")]
fn reserve_spare(xs: &mut Vec<u8>, n: usize) -> &mut [MaybeUninit<u8>] {
xs.reserve(n);
&mut xs.spare_capacity_mut()[.. n]
}
fn floor(x: usize, m: usize) -> usize {
x / m * m
}
#[inline]
fn vectorize<F: FnMut(usize)>(n: usize, bs: usize, mut f: F) {
for k in 0 .. n / bs {
for i in k * bs .. (k + 1) * bs {
f(i);
}
}
for i in floor(n, bs) .. n {
f(i);
}
}
#[derive(Debug, Copy, Clone, PartialEq, Eq)]
pub enum DecodeKind {
Length,
Symbol,
Trailing,
Padding,
}
impl core::fmt::Display for DecodeKind {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
let description = match self {
DecodeKind::Length => "invalid length",
DecodeKind::Symbol => "invalid symbol",
DecodeKind::Trailing => "non-zero trailing bits",
DecodeKind::Padding => "invalid padding length",
};
write!(f, "{description}")
}
}
#[derive(Debug, Copy, Clone, PartialEq, Eq)]
pub struct DecodeError {
pub position: usize,
pub kind: DecodeKind,
}
#[cfg(feature = "std")]
impl std::error::Error for DecodeError {}
impl core::fmt::Display for DecodeError {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
write!(f, "{} at {}", self.kind, self.position)
}
}
#[derive(Debug, Copy, Clone, PartialEq, Eq)]
pub struct DecodePartial {
pub read: usize,
pub written: usize,
pub error: DecodeError,
}
const INVALID: u8 = 128;
const IGNORE: u8 = 129;
const PADDING: u8 = 130;
fn order(msb: bool, n: usize, i: usize) -> usize {
if msb { n - 1 - i } else { i }
}
#[inline]
fn enc(bit: usize) -> usize {
match bit {
1 | 2 | 4 => 1,
3 | 6 => 3,
5 => 5,
_ => unreachable!(),
}
}
#[inline]
fn dec(bit: usize) -> usize {
enc(bit) * 8 / bit
}
fn encode_len<Bit: BitWidth>(len: usize) -> usize {
(8 * len).div_ceil(Bit::VAL)
}
fn encode_block<Bit: BitWidth, Msb: Bool>(
symbols: &[u8; 256], input: &[u8], output: &mut [MaybeUninit<u8>],
) {
debug_assert!(input.len() <= enc(Bit::VAL));
debug_assert_eq!(output.len(), encode_len::<Bit>(input.len()));
let bit = Bit::VAL;
let msb = Msb::VAL;
let mut x = 0u64;
for (i, input) in input.iter().enumerate() {
x |= u64::from(*input) << (8 * order(msb, enc(bit), i));
}
for (i, output) in output.iter_mut().enumerate() {
let y = x >> (bit * order(msb, dec(bit), i));
let _ = output.write(symbols[(y & 0xff) as usize]);
}
}
fn encode_mut<Bit: BitWidth, Msb: Bool>(
symbols: &[u8; 256], input: &[u8], output: &mut [MaybeUninit<u8>],
) {
debug_assert_eq!(output.len(), encode_len::<Bit>(input.len()));
let bit = Bit::VAL;
let enc = enc(bit);
let dec = dec(bit);
let n = input.len() / enc;
let bs = match bit {
5 => 2,
6 => 4,
_ => 1,
};
vectorize(n, bs, |i| {
let input = unsafe { chunk_unchecked(input, enc, i) };
let output = unsafe { chunk_mut_unchecked(output, dec, i) };
encode_block::<Bit, Msb>(symbols, input, output);
});
encode_block::<Bit, Msb>(symbols, &input[enc * n ..], &mut output[dec * n ..]);
}
fn decode_block<Bit: BitWidth, Msb: Bool>(
values: &[u8; 256], input: &[u8], output: &mut [MaybeUninit<u8>],
) -> Result<(), usize> {
debug_assert!(output.len() <= enc(Bit::VAL));
debug_assert_eq!(input.len(), encode_len::<Bit>(output.len()));
let bit = Bit::VAL;
let msb = Msb::VAL;
let mut x = 0u64;
for j in 0 .. input.len() {
let y = values[input[j] as usize];
check!(j, y < 1 << bit);
x |= u64::from(y) << (bit * order(msb, dec(bit), j));
}
for (j, output) in output.iter_mut().enumerate() {
let _ = output.write((x >> (8 * order(msb, enc(bit), j)) & 0xff) as u8);
}
Ok(())
}
fn decode_mut<Bit: BitWidth, Msb: Bool>(
values: &[u8; 256], input: &[u8], output: &mut [MaybeUninit<u8>],
) -> Result<(), usize> {
debug_assert_eq!(input.len(), encode_len::<Bit>(output.len()));
let bit = Bit::VAL;
let enc = enc(bit);
let dec = dec(bit);
let n = input.len() / dec;
for i in 0 .. n {
let input = unsafe { chunk_unchecked(input, dec, i) };
let output = unsafe { chunk_mut_unchecked(output, enc, i) };
decode_block::<Bit, Msb>(values, input, output).map_err(|e| dec * i + e)?;
}
decode_block::<Bit, Msb>(values, &input[dec * n ..], &mut output[enc * n ..])
.map_err(|e| dec * n + e)
}
fn check_trail<Bit: BitWidth, Msb: Bool>(
ctb: bool, values: &[u8; 256], input: &[u8],
) -> Result<(), ()> {
if 8 % Bit::VAL == 0 || !ctb {
return Ok(());
}
let trail = Bit::VAL * input.len() % 8;
if trail == 0 {
return Ok(());
}
let mut mask = (1 << trail) - 1;
if !Msb::VAL {
mask <<= Bit::VAL - trail;
}
check!((), values[input[input.len() - 1] as usize] & mask == 0);
Ok(())
}
fn check_pad<Bit: BitWidth>(values: &[u8; 256], input: &[u8]) -> Result<usize, usize> {
let bit = Bit::VAL;
debug_assert_eq!(input.len(), dec(bit));
let is_pad = |x: &&u8| values[**x as usize] == PADDING;
let count = input.iter().rev().take_while(is_pad).count();
let len = input.len() - count;
check!(len, len > 0 && bit * len % 8 < bit);
Ok(len)
}
fn encode_base_len<Bit: BitWidth>(len: usize) -> usize {
encode_len::<Bit>(len)
}
fn encode_base<Bit: BitWidth, Msb: Bool>(
symbols: &[u8; 256], input: &[u8], output: &mut [MaybeUninit<u8>],
) {
debug_assert_eq!(output.len(), encode_base_len::<Bit>(input.len()));
encode_mut::<Bit, Msb>(symbols, input, output);
}
fn encode_pad_len<Bit: BitWidth, Pad: Bool>(len: usize) -> usize {
match Pad::VAL {
false => encode_base_len::<Bit>(len),
true => len.div_ceil(enc(Bit::VAL)) * dec(Bit::VAL),
}
}
fn encode_pad<Bit: BitWidth, Msb: Bool, Pad: Bool>(
symbols: &[u8; 256], pad: Pad::If<u8, ()>, input: &[u8], output: &mut [MaybeUninit<u8>],
) {
let pad = match Pad::open(pad) {
If::Then(x) => x,
If::Else(()) => return encode_base::<Bit, Msb>(symbols, input, output),
};
debug_assert_eq!(output.len(), encode_pad_len::<Bit, Pad>(input.len()));
let olen = encode_base_len::<Bit>(input.len());
encode_base::<Bit, Msb>(symbols, input, &mut output[.. olen]);
for output in output.iter_mut().skip(olen) {
let _ = output.write(pad);
}
}
fn encode_wrap_len<Bit: BitWidth, Pad: Bool, Wrap: Bool>(
wrap: Wrap::If<(usize, &[u8]), ()>, ilen: usize,
) -> usize {
let olen = encode_pad_len::<Bit, Pad>(ilen);
match Wrap::open(wrap) {
If::Then((col, end)) => olen + end.len() * olen.div_ceil(col),
If::Else(()) => olen,
}
}
fn encode_wrap_mut<Bit: BitWidth, Msb: Bool, Pad: Bool, Wrap: Bool>(
symbols: &[u8; 256], pad: Pad::If<u8, ()>, wrap: Wrap::If<(usize, &[u8]), ()>, input: &[u8],
output: &mut [MaybeUninit<u8>],
) {
let (col, end) = match Wrap::open(wrap) {
If::Then((col, end)) => (col, end),
If::Else(()) => return encode_pad::<Bit, Msb, Pad>(symbols, pad, input, output),
};
debug_assert_eq!(output.len(), encode_wrap_len::<Bit, Pad, Wrap>(wrap, input.len()));
debug_assert_eq!(col % dec(Bit::VAL), 0);
let bit = Bit::VAL;
let col = col / dec(bit);
let enc = col * enc(bit);
let dec = col * dec(bit) + end.len();
let olen = dec - end.len();
let n = input.len() / enc;
for i in 0 .. n {
let input = unsafe { chunk_unchecked(input, enc, i) };
let output = unsafe { chunk_mut_unchecked(output, dec, i) };
encode_base::<Bit, Msb>(symbols, input, &mut output[.. olen]);
unsafe { copy_from_slice(&mut output[olen ..], end) };
}
if input.len() > enc * n {
let olen = dec * n + encode_pad_len::<Bit, Pad>(input.len() - enc * n);
encode_pad::<Bit, Msb, Pad>(symbols, pad, &input[enc * n ..], &mut output[dec * n .. olen]);
unsafe { copy_from_slice(&mut output[olen ..], end) };
}
}
fn decode_wrap_len<Bit: BitWidth, Pad: Bool>(len: usize) -> (usize, usize) {
let bit = Bit::VAL;
if Pad::VAL {
(floor(len, dec(bit)), len / dec(bit) * enc(bit))
} else {
let trail = bit * len % 8;
(len - trail / bit, bit * len / 8)
}
}
fn decode_pad_len<Bit: BitWidth, Pad: Bool>(len: usize) -> Result<usize, DecodeError> {
let (ilen, olen) = decode_wrap_len::<Bit, Pad>(len);
check!(DecodeError { position: ilen, kind: DecodeKind::Length }, ilen == len);
Ok(olen)
}
fn decode_base_len<Bit: BitWidth>(len: usize) -> Result<usize, DecodeError> {
decode_pad_len::<Bit, False>(len)
}
fn decode_base_mut<Bit: BitWidth, Msb: Bool>(
ctb: bool, values: &[u8; 256], input: &[u8], output: &mut [MaybeUninit<u8>],
) -> Result<usize, DecodePartial> {
debug_assert_eq!(Ok(output.len()), decode_base_len::<Bit>(input.len()));
let bit = Bit::VAL;
let fail = |pos, kind| DecodePartial {
read: pos / dec(bit) * dec(bit),
written: pos / dec(bit) * enc(bit),
error: DecodeError { position: pos, kind },
};
decode_mut::<Bit, Msb>(values, input, output).map_err(|pos| fail(pos, DecodeKind::Symbol))?;
check_trail::<Bit, Msb>(ctb, values, input)
.map_err(|()| fail(input.len() - 1, DecodeKind::Trailing))?;
Ok(output.len())
}
fn decode_pad_mut<Bit: BitWidth, Msb: Bool, Pad: Bool>(
ctb: bool, values: &[u8; 256], input: &[u8], output: &mut [MaybeUninit<u8>],
) -> Result<usize, DecodePartial> {
if !Pad::VAL {
return decode_base_mut::<Bit, Msb>(ctb, values, input, output);
}
debug_assert_eq!(Ok(output.len()), decode_pad_len::<Bit, Pad>(input.len()));
let bit = Bit::VAL;
let enc = enc(bit);
let dec = dec(bit);
let mut inpos = 0;
let mut outpos = 0;
let mut outend = output.len();
while inpos < input.len() {
match decode_base_mut::<Bit, Msb>(
ctb,
values,
&input[inpos ..],
&mut output[outpos .. outend],
) {
Ok(written) => {
if cfg!(debug_assertions) {
inpos = input.len();
}
outpos += written;
break;
}
Err(partial) => {
inpos += partial.read;
outpos += partial.written;
}
}
let inlen = check_pad::<Bit>(values, &input[inpos .. inpos + dec]).map_err(|pos| {
DecodePartial {
read: inpos,
written: outpos,
error: DecodeError { position: inpos + pos, kind: DecodeKind::Padding },
}
})?;
let outlen = decode_base_len::<Bit>(inlen).unwrap();
let written = decode_base_mut::<Bit, Msb>(
ctb,
values,
&input[inpos .. inpos + inlen],
&mut output[outpos .. outpos + outlen],
)
.map_err(|partial| {
debug_assert_eq!(partial.read, 0);
debug_assert_eq!(partial.written, 0);
DecodePartial {
read: inpos,
written: outpos,
error: DecodeError {
position: inpos + partial.error.position,
kind: partial.error.kind,
},
}
})?;
debug_assert_eq!(written, outlen);
inpos += dec;
outpos += outlen;
outend -= enc - outlen;
}
debug_assert_eq!(inpos, input.len());
debug_assert_eq!(outpos, outend);
Ok(outend)
}
fn skip_ignore(values: &[u8; 256], input: &[u8], mut inpos: usize) -> usize {
while inpos < input.len() && values[input[inpos] as usize] == IGNORE {
inpos += 1;
}
inpos
}
fn decode_wrap_block<Bit: BitWidth, Msb: Bool, Pad: Bool>(
ctb: bool, values: &[u8; 256], input: &[u8], output: &mut [MaybeUninit<u8>],
) -> Result<(usize, usize), DecodeError> {
let bit = Bit::VAL;
let dec = dec(bit);
let mut buf = [0u8; 8];
let mut shift = [0usize; 8];
let mut bufpos = 0;
let mut inpos = 0;
while bufpos < dec {
inpos = skip_ignore(values, input, inpos);
if inpos == input.len() {
break;
}
shift[bufpos] = inpos;
buf[bufpos] = input[inpos];
bufpos += 1;
inpos += 1;
}
let olen = decode_pad_len::<Bit, Pad>(bufpos).map_err(|mut e| {
e.position = shift[e.position];
e
})?;
let written =
decode_pad_mut::<Bit, Msb, Pad>(ctb, values, &buf[.. bufpos], &mut output[.. olen])
.map_err(|partial| {
debug_assert_eq!(partial.read, 0);
debug_assert_eq!(partial.written, 0);
DecodeError { position: shift[partial.error.position], kind: partial.error.kind }
})?;
Ok((inpos, written))
}
fn decode_wrap_mut<Bit: BitWidth, Msb: Bool, Pad: Bool, Ignore: Bool>(
ctb: bool, values: &[u8; 256], input: &[u8], output: &mut [MaybeUninit<u8>],
) -> Result<usize, DecodePartial> {
if !Ignore::VAL {
return decode_pad_mut::<Bit, Msb, Pad>(ctb, values, input, output);
}
debug_assert_eq!(output.len(), decode_wrap_len::<Bit, Pad>(input.len()).1);
let mut inpos = 0;
let mut outpos = 0;
while inpos < input.len() {
let (inlen, outlen) = decode_wrap_len::<Bit, Pad>(input.len() - inpos);
match decode_pad_mut::<Bit, Msb, Pad>(
ctb,
values,
&input[inpos .. inpos + inlen],
&mut output[outpos .. outpos + outlen],
) {
Ok(written) => {
inpos += inlen;
outpos += written;
break;
}
Err(partial) => {
inpos += partial.read;
outpos += partial.written;
}
}
let (ipos, opos) = decode_wrap_block::<Bit, Msb, Pad>(
ctb,
values,
&input[inpos ..],
&mut output[outpos ..],
)
.map_err(|mut error| {
error.position += inpos;
DecodePartial { read: inpos, written: outpos, error }
})?;
inpos += ipos;
outpos += opos;
}
let inpos = skip_ignore(values, input, inpos);
if inpos == input.len() {
Ok(outpos)
} else {
Err(DecodePartial {
read: inpos,
written: outpos,
error: DecodeError { position: inpos, kind: DecodeKind::Length },
})
}
}
#[derive(Debug, Copy, Clone, PartialEq, Eq)]
pub enum ConvertError {
BitWidth,
BitOrder,
Padding,
Wrap,
Ignore,
}
#[derive(Debug, Clone, PartialEq, Eq)]
#[repr(transparent)]
pub struct Encoding<Bit: BitWidth, Msb: Bool, Pad: Bool, Wrap: Bool, Ignore: Bool> {
data: InternalEncoding,
_type: PhantomData<(Bit, Msb, Pad, Wrap, Ignore)>,
}
#[derive(Debug, Clone, PartialEq, Eq)]
#[repr(transparent)]
pub struct DynEncoding(InternalEncoding);
#[cfg(feature = "alloc")]
type InternalEncoding = Cow<'static, [u8]>;
#[cfg(not(feature = "alloc"))]
type InternalEncoding = &'static [u8];
impl<Bit: BitWidth, Msb: Bool, Pad: Bool, Wrap: Bool, Ignore: Bool>
Encoding<Bit, Msb, Pad, Wrap, Ignore>
{
fn sym(&self) -> &[u8; 256] {
self.data[0 .. 256].try_into().unwrap()
}
fn val(&self) -> &[u8; 256] {
self.data[256 .. 512].try_into().unwrap()
}
fn pad(&self) -> Pad::If<u8, ()> {
Pad::make(|| self.data[512], || ())
}
fn ctb(&self) -> bool {
self.data[513] & 0x10 != 0
}
fn wrap(&self) -> Wrap::If<(usize, &[u8]), ()> {
Wrap::make(|| (self.data[514] as usize, &self.data[515 ..]), || ())
}
fn has_ignore(&self) -> bool {
self.data.len() >= 515
}
fn block_len(&self) -> (usize, usize) {
let bit = Bit::VAL;
match Wrap::open(self.wrap()) {
If::Then((col, end)) => (col / dec(bit) * enc(bit), col + end.len()),
If::Else(()) => (enc(bit), dec(bit)),
}
}
#[must_use]
pub fn encode_len(&self, len: usize) -> usize {
encode_wrap_len::<Bit, Pad, Wrap>(self.wrap(), len)
}
pub fn encode_mut_uninit<'a>(
&self, input: &[u8], output: &'a mut [MaybeUninit<u8>],
) -> &'a mut [u8] {
assert_eq!(output.len(), self.encode_len(input.len()));
encode_wrap_mut::<Bit, Msb, Pad, Wrap>(self.sym(), self.pad(), self.wrap(), input, output);
unsafe { slice_assume_init_mut(output) }
}
pub fn encode_mut(&self, input: &[u8], output: &mut [u8]) {
let _ = self.encode_mut_uninit(input, unsafe { slice_uninit_mut(output) });
}
#[cfg(feature = "alloc")]
pub fn encode_append(&self, input: &[u8], output: &mut String) {
let output = unsafe { output.as_mut_vec() };
let output_len = output.len();
let len = self.encode_len(input.len());
let actual_len = self.encode_mut_uninit(input, reserve_spare(output, len)).len();
debug_assert_eq!(actual_len, len);
unsafe { output.set_len(output_len + len) };
}
pub fn encode_write_buffer_uninit(
&self, input: &[u8], output: &mut impl core::fmt::Write, buffer: &mut [MaybeUninit<u8>],
) -> core::fmt::Result {
assert!(510 <= buffer.len());
let (enc, dec) = self.block_len();
for input in input.chunks(buffer.len() / dec * enc) {
let buffer = &mut buffer[.. self.encode_len(input.len())];
let buffer = self.encode_mut_uninit(input, buffer);
output.write_str(unsafe { core::str::from_utf8_unchecked(buffer) })?;
}
Ok(())
}
pub fn encode_write_buffer(
&self, input: &[u8], output: &mut impl core::fmt::Write, buffer: &mut [u8],
) -> core::fmt::Result {
self.encode_write_buffer_uninit(input, output, unsafe { slice_uninit_mut(buffer) })
}
pub fn encode_write(
&self, input: &[u8], output: &mut impl core::fmt::Write,
) -> core::fmt::Result {
self.encode_write_buffer(input, output, &mut [0; 1024])
}
#[cfg(feature = "alloc")]
#[must_use]
pub fn encode(&self, input: &[u8]) -> String {
let mut output = Vec::new();
let len = self.encode_len(input.len());
let actual_len = self.encode_mut_uninit(input, reserve_spare(&mut output, len)).len();
debug_assert_eq!(actual_len, len);
unsafe { output.set_len(len) };
unsafe { String::from_utf8_unchecked(output) }
}
pub fn decode_len(&self, len: usize) -> Result<usize, DecodeError> {
let (ilen, olen) = decode_wrap_len::<Bit, Pad>(len);
check!(
DecodeError { position: ilen, kind: DecodeKind::Length },
self.has_ignore() || len == ilen
);
Ok(olen)
}
pub fn decode_mut_uninit<'a>(
&self, input: &[u8], output: &'a mut [MaybeUninit<u8>],
) -> Result<&'a mut [u8], DecodePartial> {
assert_eq!(Ok(output.len()), self.decode_len(input.len()));
let len = decode_wrap_mut::<Bit, Msb, Pad, Ignore>(self.ctb(), self.val(), input, output)?;
Ok(unsafe { slice_assume_init_mut(&mut output[.. len]) })
}
pub fn decode_mut(&self, input: &[u8], output: &mut [u8]) -> Result<usize, DecodePartial> {
Ok(self.decode_mut_uninit(input, unsafe { slice_uninit_mut(output) })?.len())
}
#[cfg(feature = "alloc")]
pub fn decode(&self, input: &[u8]) -> Result<Vec<u8>, DecodeError> {
let max_len = self.decode_len(input.len())?;
let mut output = Vec::new();
let len = self
.decode_mut_uninit(input, reserve_spare(&mut output, max_len))
.map_err(|partial| partial.error)?
.len();
unsafe { output.set_len(len) };
Ok(output)
}
#[cfg(feature = "alloc")]
#[must_use]
pub fn specification(&self) -> Specification {
DynEncoding::specification(self.into())
}
#[must_use]
pub fn as_dyn(&self) -> &DynEncoding {
self.into()
}
#[doc(hidden)]
#[must_use]
pub const unsafe fn new_unchecked(data: &'static [u8]) -> Self {
#[cfg(feature = "alloc")]
let data = Cow::Borrowed(data);
Encoding { data, _type: PhantomData }
}
fn check_compatible(base: &DynEncoding) -> Result<(), ConvertError> {
check!(ConvertError::BitWidth, base.bit() == Bit::VAL);
check!(ConvertError::BitOrder, base.msb() == Msb::VAL);
check!(ConvertError::Padding, base.pad().is_some() == Pad::VAL);
check!(ConvertError::Wrap, base.wrap().is_some() == Wrap::VAL);
check!(ConvertError::Ignore, base.has_ignore() == Ignore::VAL);
Ok(())
}
}
impl DynEncoding {
fn sym(&self) -> &[u8; 256] {
self.0[0 .. 256].try_into().unwrap()
}
fn val(&self) -> &[u8; 256] {
self.0[256 .. 512].try_into().unwrap()
}
fn pad(&self) -> Option<u8> {
if self.0[512] < 128 { Some(self.0[512]) } else { None }
}
fn ctb(&self) -> bool {
self.0[513] & 0x10 != 0
}
fn msb(&self) -> bool {
self.0[513] & 0x8 != 0
}
fn bit(&self) -> usize {
(self.0[513] & 0x7) as usize
}
fn block_len(&self) -> (usize, usize) {
let bit = self.bit();
match self.wrap() {
Some((col, end)) => (col / dec(bit) * enc(bit), col + end.len()),
None => (enc(bit), dec(bit)),
}
}
fn wrap(&self) -> Option<(usize, &[u8])> {
if self.0.len() <= 515 {
return None;
}
Some((self.0[514] as usize, &self.0[515 ..]))
}
fn has_ignore(&self) -> bool {
self.0.len() >= 515
}
#[must_use]
pub fn encode_len(&self, len: usize) -> usize {
dispatch!(self.encode_len(len))
}
#[allow(clippy::cognitive_complexity)]
pub fn encode_mut(&self, input: &[u8], output: &mut [u8]) {
dispatch!(self.encode_mut(input, output))
}
#[cfg(feature = "alloc")]
pub fn encode_append(&self, input: &[u8], output: &mut String) {
let output = unsafe { output.as_mut_vec() };
let output_len = output.len();
output.resize(output_len + self.encode_len(input.len()), 0u8);
self.encode_mut(input, &mut output[output_len ..]);
}
pub fn encode_write(
&self, input: &[u8], output: &mut impl core::fmt::Write,
) -> core::fmt::Result {
self.encode_write_buffer(input, output, &mut [0; 1024])
}
pub fn encode_write_buffer(
&self, input: &[u8], output: &mut impl core::fmt::Write, buffer: &mut [u8],
) -> core::fmt::Result {
assert!(510 <= buffer.len());
let (enc, dec) = self.block_len();
for input in input.chunks(buffer.len() / dec * enc) {
let buffer = &mut buffer[.. self.encode_len(input.len())];
self.encode_mut(input, buffer);
output.write_str(unsafe { core::str::from_utf8_unchecked(buffer) })?;
}
Ok(())
}
#[cfg(feature = "alloc")]
#[must_use]
pub fn encode(&self, input: &[u8]) -> String {
let mut output = vec![0u8; self.encode_len(input.len())];
self.encode_mut(input, &mut output);
unsafe { String::from_utf8_unchecked(output) }
}
pub fn decode_len(&self, len: usize) -> Result<usize, DecodeError> {
dispatch!(self.decode_len(len))
}
#[allow(clippy::cognitive_complexity)]
pub fn decode_mut(&self, input: &[u8], output: &mut [u8]) -> Result<usize, DecodePartial> {
dispatch!(self.decode_mut(input, output))
}
#[cfg(feature = "alloc")]
pub fn decode(&self, input: &[u8]) -> Result<Vec<u8>, DecodeError> {
let mut output = vec![0u8; self.decode_len(input.len())?];
let len = self.decode_mut(input, &mut output).map_err(|partial| partial.error)?;
output.truncate(len);
Ok(output)
}
#[must_use]
pub fn bit_width(&self) -> usize {
self.bit()
}
#[must_use]
pub fn is_canonical(&self) -> bool {
if !self.ctb() {
return false;
}
let bit = self.bit();
let sym = self.sym();
let val = self.val();
for i in 0 .. 256 {
if val[i] == INVALID {
continue;
}
if val[i] >= 1 << bit {
return false;
}
if sym[val[i] as usize] as usize != i {
return false;
}
}
true
}
#[allow(clippy::missing_panics_doc)] #[cfg(feature = "alloc")]
#[must_use]
pub fn specification(&self) -> Specification {
let mut specification = Specification::new();
specification
.symbols
.push_str(core::str::from_utf8(&self.sym()[0 .. 1 << self.bit()]).unwrap());
specification.bit_order =
if self.msb() { MostSignificantFirst } else { LeastSignificantFirst };
specification.check_trailing_bits = self.ctb();
if let Some(pad) = self.pad() {
specification.padding = Some(pad as char);
}
for i in 0 .. 128u8 {
if self.val()[i as usize] != IGNORE {
continue;
}
specification.ignore.push(i as char);
}
if let Some((col, end)) = self.wrap() {
specification.wrap.width = col;
specification.wrap.separator = core::str::from_utf8(end).unwrap().to_owned();
}
for i in 0 .. 128u8 {
let canonical = if self.val()[i as usize] < 1 << self.bit() {
self.sym()[self.val()[i as usize] as usize]
} else if self.val()[i as usize] == PADDING {
self.pad().unwrap()
} else {
continue;
};
if i == canonical {
continue;
}
specification.translate.from.push(i as char);
specification.translate.to.push(canonical as char);
}
specification
}
#[doc(hidden)]
#[must_use]
pub const unsafe fn internal_new(implementation: &'static [u8]) -> DynEncoding {
#[cfg(feature = "alloc")]
let encoding = DynEncoding(Cow::Borrowed(implementation));
#[cfg(not(feature = "alloc"))]
let encoding = DynEncoding(implementation);
encoding
}
#[doc(hidden)]
#[must_use]
pub fn internal_implementation(&self) -> &[u8] {
&self.0
}
}
impl<Bit: BitWidth, Msb: Bool, Pad: Bool, Wrap: Bool, Ignore: Bool> TryFrom<DynEncoding>
for Encoding<Bit, Msb, Pad, Wrap, Ignore>
{
type Error = ConvertError;
fn try_from(base: DynEncoding) -> Result<Self, Self::Error> {
Encoding::<Bit, Msb, Pad, Wrap, Ignore>::check_compatible(&base)?;
Ok(Encoding { data: base.0, _type: PhantomData })
}
}
impl<Bit: BitWidth, Msb: Bool, Pad: Bool, Wrap: Bool, Ignore: Bool>
From<Encoding<Bit, Msb, Pad, Wrap, Ignore>> for DynEncoding
{
fn from(base: Encoding<Bit, Msb, Pad, Wrap, Ignore>) -> Self {
DynEncoding(base.data)
}
}
impl<'a, Bit: BitWidth, Msb: Bool, Pad: Bool, Wrap: Bool, Ignore: Bool> TryFrom<&'a DynEncoding>
for &'a Encoding<Bit, Msb, Pad, Wrap, Ignore>
{
type Error = ConvertError;
fn try_from(base: &'a DynEncoding) -> Result<Self, Self::Error> {
Encoding::<Bit, Msb, Pad, Wrap, Ignore>::check_compatible(base)?;
Ok(unsafe { cast(base) })
}
}
impl<'a, Bit: BitWidth, Msb: Bool, Pad: Bool, Wrap: Bool, Ignore: Bool>
From<&'a Encoding<Bit, Msb, Pad, Wrap, Ignore>> for &'a DynEncoding
{
fn from(base: &'a Encoding<Bit, Msb, Pad, Wrap, Ignore>) -> Self {
unsafe { &*core::ptr::from_ref(base).cast::<DynEncoding>() }
}
}
#[derive(Debug, Copy, Clone, PartialEq, Eq)]
#[cfg(feature = "alloc")]
pub enum BitOrder {
MostSignificantFirst,
LeastSignificantFirst,
}
#[cfg(feature = "alloc")]
use crate::BitOrder::*;
#[derive(Debug, Clone)]
#[cfg(feature = "alloc")]
pub struct Translate {
pub from: String,
pub to: String,
}
#[derive(Debug, Clone)]
#[cfg(feature = "alloc")]
pub struct Wrap {
pub width: usize,
pub separator: String,
}
#[derive(Debug, Clone)]
#[cfg(feature = "alloc")]
pub struct Specification {
pub symbols: String,
pub bit_order: BitOrder,
pub check_trailing_bits: bool,
pub padding: Option<char>,
pub ignore: String,
pub wrap: Wrap,
pub translate: Translate,
}
#[cfg(feature = "alloc")]
impl Default for Specification {
fn default() -> Self {
Self::new()
}
}
#[derive(Debug, Copy, Clone)]
#[cfg(feature = "alloc")]
enum SpecificationErrorImpl {
BadSize,
NotAscii,
Duplicate(u8),
ExtraPadding,
WrapLength,
WrapWidth(u8),
FromTo,
Undefined(u8),
}
#[cfg(feature = "alloc")]
use crate::SpecificationErrorImpl::*;
#[derive(Debug, Copy, Clone)]
#[cfg(feature = "alloc")]
pub struct SpecificationError(SpecificationErrorImpl);
#[cfg(feature = "alloc")]
impl core::fmt::Display for SpecificationError {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
match self.0 {
BadSize => write!(f, "invalid number of symbols"),
NotAscii => write!(f, "non-ascii character"),
Duplicate(c) => write!(f, "{:?} has conflicting definitions", c as char),
ExtraPadding => write!(f, "unnecessary padding"),
WrapLength => write!(f, "invalid wrap width or separator length"),
WrapWidth(x) => write!(f, "wrap width not a multiple of {x}"),
FromTo => write!(f, "translate from/to length mismatch"),
Undefined(c) => write!(f, "{:?} is undefined", c as char),
}
}
}
#[cfg(feature = "std")]
impl std::error::Error for SpecificationError {
fn description(&self) -> &str {
match self.0 {
BadSize => "invalid number of symbols",
NotAscii => "non-ascii character",
Duplicate(_) => "conflicting definitions",
ExtraPadding => "unnecessary padding",
WrapLength => "invalid wrap width or separator length",
WrapWidth(_) => "wrap width not a multiple",
FromTo => "translate from/to length mismatch",
Undefined(_) => "undefined character",
}
}
}
#[cfg(feature = "alloc")]
impl Specification {
#[must_use]
pub fn new() -> Specification {
Specification {
symbols: String::new(),
bit_order: MostSignificantFirst,
check_trailing_bits: true,
padding: None,
ignore: String::new(),
wrap: Wrap { width: 0, separator: String::new() },
translate: Translate { from: String::new(), to: String::new() },
}
}
pub fn encoding(&self) -> Result<DynEncoding, SpecificationError> {
let symbols = self.symbols.as_bytes();
let bit: u8 = match symbols.len() {
2 => 1,
4 => 2,
8 => 3,
16 => 4,
32 => 5,
64 => 6,
_ => return Err(SpecificationError(BadSize)),
};
let mut values = [INVALID; 128];
let set = |v: &mut [u8; 128], i: u8, x: u8| {
check!(SpecificationError(NotAscii), i < 128);
if v[i as usize] == x {
return Ok(());
}
check!(SpecificationError(Duplicate(i)), v[i as usize] == INVALID);
v[i as usize] = x;
Ok(())
};
for (v, symbols) in symbols.iter().enumerate() {
#[allow(clippy::cast_possible_truncation)] set(&mut values, *symbols, v as u8)?;
}
let msb = self.bit_order == MostSignificantFirst;
let ctb = self.check_trailing_bits || 8 % bit == 0;
let pad = match self.padding {
None => None,
Some(pad) => {
check!(SpecificationError(ExtraPadding), 8 % bit != 0);
check!(SpecificationError(NotAscii), pad.len_utf8() == 1);
set(&mut values, pad as u8, PADDING)?;
Some(pad as u8)
}
};
for i in self.ignore.bytes() {
set(&mut values, i, IGNORE)?;
}
let wrap = if self.wrap.separator.is_empty() || self.wrap.width == 0 {
None
} else {
let col = self.wrap.width;
let end = self.wrap.separator.as_bytes();
check!(SpecificationError(WrapLength), col < 256 && end.len() < 256);
#[allow(clippy::cast_possible_truncation)] let col = col as u8;
#[allow(clippy::cast_possible_truncation)] let dec = dec(bit as usize) as u8;
check!(SpecificationError(WrapWidth(dec)), col % dec == 0);
for &i in end {
set(&mut values, i, IGNORE)?;
}
Some((col, end))
};
let from = self.translate.from.as_bytes();
let to = self.translate.to.as_bytes();
check!(SpecificationError(FromTo), from.len() == to.len());
for i in 0 .. from.len() {
check!(SpecificationError(NotAscii), to[i] < 128);
let v = values[to[i] as usize];
check!(SpecificationError(Undefined(to[i])), v != INVALID);
set(&mut values, from[i], v)?;
}
let mut encoding = Vec::new();
for _ in 0 .. 256 / symbols.len() {
encoding.extend_from_slice(symbols);
}
encoding.extend_from_slice(&values);
encoding.extend_from_slice(&[INVALID; 128]);
match pad {
None => encoding.push(INVALID),
Some(pad) => encoding.push(pad),
}
encoding.push(bit);
if msb {
encoding[513] |= 0x08;
}
if ctb {
encoding[513] |= 0x10;
}
if let Some((col, end)) = wrap {
encoding.push(col);
encoding.extend_from_slice(end);
} else if values.contains(&IGNORE) {
encoding.push(0);
}
Ok(DynEncoding(Cow::Owned(encoding)))
}
}
pub type Hex = Encoding<Bit4, True, False, False, False>;
pub type Base32 = Encoding<Bit5, True, True, False, False>;
pub type Base32NoPad = Encoding<Bit5, True, False, False, False>;
pub type Base32LsbNoPad = Encoding<Bit5, False, False, False, False>;
pub type Base64 = Encoding<Bit6, True, True, False, False>;
pub type Base64NoPad = Encoding<Bit6, True, False, False, False>;
pub type Base64Wrap = Encoding<Bit6, True, True, True, True>;
pub static HEXLOWER: Hex = unsafe { Hex::new_unchecked(HEXLOWER_IMPL) };
const HEXLOWER_IMPL: &[u8] = &[
48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 97, 98, 99, 100, 101, 102, 48, 49, 50, 51, 52, 53, 54,
55, 56, 57, 97, 98, 99, 100, 101, 102, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 97, 98, 99, 100,
101, 102, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 97, 98, 99, 100, 101, 102, 48, 49, 50, 51,
52, 53, 54, 55, 56, 57, 97, 98, 99, 100, 101, 102, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 97,
98, 99, 100, 101, 102, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 97, 98, 99, 100, 101, 102, 48,
49, 50, 51, 52, 53, 54, 55, 56, 57, 97, 98, 99, 100, 101, 102, 48, 49, 50, 51, 52, 53, 54, 55,
56, 57, 97, 98, 99, 100, 101, 102, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 97, 98, 99, 100,
101, 102, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 97, 98, 99, 100, 101, 102, 48, 49, 50, 51,
52, 53, 54, 55, 56, 57, 97, 98, 99, 100, 101, 102, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 97,
98, 99, 100, 101, 102, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 97, 98, 99, 100, 101, 102, 48,
49, 50, 51, 52, 53, 54, 55, 56, 57, 97, 98, 99, 100, 101, 102, 48, 49, 50, 51, 52, 53, 54, 55,
56, 57, 97, 98, 99, 100, 101, 102, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 0, 1, 2,
3, 4, 5, 6, 7, 8, 9, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
128, 128, 128, 128, 128, 10, 11, 12, 13, 14, 15, 128, 128, 128, 128, 128, 128, 128, 128, 128,
128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 28,
];
pub static HEXLOWER_PERMISSIVE: Hex = unsafe { Hex::new_unchecked(HEXLOWER_PERMISSIVE_IMPL) };
const HEXLOWER_PERMISSIVE_IMPL: &[u8] = &[
48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 97, 98, 99, 100, 101, 102, 48, 49, 50, 51, 52, 53, 54,
55, 56, 57, 97, 98, 99, 100, 101, 102, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 97, 98, 99, 100,
101, 102, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 97, 98, 99, 100, 101, 102, 48, 49, 50, 51,
52, 53, 54, 55, 56, 57, 97, 98, 99, 100, 101, 102, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 97,
98, 99, 100, 101, 102, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 97, 98, 99, 100, 101, 102, 48,
49, 50, 51, 52, 53, 54, 55, 56, 57, 97, 98, 99, 100, 101, 102, 48, 49, 50, 51, 52, 53, 54, 55,
56, 57, 97, 98, 99, 100, 101, 102, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 97, 98, 99, 100,
101, 102, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 97, 98, 99, 100, 101, 102, 48, 49, 50, 51,
52, 53, 54, 55, 56, 57, 97, 98, 99, 100, 101, 102, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 97,
98, 99, 100, 101, 102, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 97, 98, 99, 100, 101, 102, 48,
49, 50, 51, 52, 53, 54, 55, 56, 57, 97, 98, 99, 100, 101, 102, 48, 49, 50, 51, 52, 53, 54, 55,
56, 57, 97, 98, 99, 100, 101, 102, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 0, 1, 2,
3, 4, 5, 6, 7, 8, 9, 128, 128, 128, 128, 128, 128, 128, 10, 11, 12, 13, 14, 15, 128, 128, 128,
128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
128, 128, 128, 128, 10, 11, 12, 13, 14, 15, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 28,
];
pub static HEXUPPER: Hex = unsafe { Hex::new_unchecked(HEXUPPER_IMPL) };
const HEXUPPER_IMPL: &[u8] = &[
48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 65, 66, 67, 68, 69, 70, 48, 49, 50, 51, 52, 53, 54, 55,
56, 57, 65, 66, 67, 68, 69, 70, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 65, 66, 67, 68, 69, 70,
48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 65, 66, 67, 68, 69, 70, 48, 49, 50, 51, 52, 53, 54, 55,
56, 57, 65, 66, 67, 68, 69, 70, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 65, 66, 67, 68, 69, 70,
48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 65, 66, 67, 68, 69, 70, 48, 49, 50, 51, 52, 53, 54, 55,
56, 57, 65, 66, 67, 68, 69, 70, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 65, 66, 67, 68, 69, 70,
48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 65, 66, 67, 68, 69, 70, 48, 49, 50, 51, 52, 53, 54, 55,
56, 57, 65, 66, 67, 68, 69, 70, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 65, 66, 67, 68, 69, 70,
48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 65, 66, 67, 68, 69, 70, 48, 49, 50, 51, 52, 53, 54, 55,
56, 57, 65, 66, 67, 68, 69, 70, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 65, 66, 67, 68, 69, 70,
48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 65, 66, 67, 68, 69, 70, 128, 128, 128, 128, 128, 128,
128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
128, 128, 128, 128, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 128, 128, 128, 128, 128, 128, 128, 10, 11,
12, 13, 14, 15, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 28,
];
pub static HEXUPPER_PERMISSIVE: Hex = unsafe { Hex::new_unchecked(HEXUPPER_PERMISSIVE_IMPL) };
const HEXUPPER_PERMISSIVE_IMPL: &[u8] = &[
48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 65, 66, 67, 68, 69, 70, 48, 49, 50, 51, 52, 53, 54, 55,
56, 57, 65, 66, 67, 68, 69, 70, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 65, 66, 67, 68, 69, 70,
48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 65, 66, 67, 68, 69, 70, 48, 49, 50, 51, 52, 53, 54, 55,
56, 57, 65, 66, 67, 68, 69, 70, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 65, 66, 67, 68, 69, 70,
48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 65, 66, 67, 68, 69, 70, 48, 49, 50, 51, 52, 53, 54, 55,
56, 57, 65, 66, 67, 68, 69, 70, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 65, 66, 67, 68, 69, 70,
48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 65, 66, 67, 68, 69, 70, 48, 49, 50, 51, 52, 53, 54, 55,
56, 57, 65, 66, 67, 68, 69, 70, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 65, 66, 67, 68, 69, 70,
48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 65, 66, 67, 68, 69, 70, 48, 49, 50, 51, 52, 53, 54, 55,
56, 57, 65, 66, 67, 68, 69, 70, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 65, 66, 67, 68, 69, 70,
48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 65, 66, 67, 68, 69, 70, 128, 128, 128, 128, 128, 128,
128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
128, 128, 128, 128, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 128, 128, 128, 128, 128, 128, 128, 10, 11,
12, 13, 14, 15, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 10, 11, 12, 13, 14, 15, 128, 128, 128, 128,
128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 28,
];
pub static BASE32: Base32 = unsafe { Base32::new_unchecked(BASE32_IMPL) };
const BASE32_IMPL: &[u8] = &[
65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88,
89, 90, 50, 51, 52, 53, 54, 55, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80,
81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 50, 51, 52, 53, 54, 55, 65, 66, 67, 68, 69, 70, 71, 72,
73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 50, 51, 52, 53, 54, 55,
65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88,
89, 90, 50, 51, 52, 53, 54, 55, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80,
81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 50, 51, 52, 53, 54, 55, 65, 66, 67, 68, 69, 70, 71, 72,
73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 50, 51, 52, 53, 54, 55,
65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88,
89, 90, 50, 51, 52, 53, 54, 55, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80,
81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 50, 51, 52, 53, 54, 55, 128, 128, 128, 128, 128, 128,
128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
128, 128, 128, 128, 128, 128, 26, 27, 28, 29, 30, 31, 128, 128, 128, 128, 128, 130, 128, 128,
128, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
25, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 61, 29,
];
pub static BASE32_NOPAD: Base32NoPad = unsafe { Base32NoPad::new_unchecked(BASE32_NOPAD_IMPL) };
const BASE32_NOPAD_IMPL: &[u8] = &[
65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88,
89, 90, 50, 51, 52, 53, 54, 55, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80,
81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 50, 51, 52, 53, 54, 55, 65, 66, 67, 68, 69, 70, 71, 72,
73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 50, 51, 52, 53, 54, 55,
65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88,
89, 90, 50, 51, 52, 53, 54, 55, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80,
81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 50, 51, 52, 53, 54, 55, 65, 66, 67, 68, 69, 70, 71, 72,
73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 50, 51, 52, 53, 54, 55,
65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88,
89, 90, 50, 51, 52, 53, 54, 55, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80,
81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 50, 51, 52, 53, 54, 55, 128, 128, 128, 128, 128, 128,
128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
128, 128, 128, 128, 128, 128, 26, 27, 28, 29, 30, 31, 128, 128, 128, 128, 128, 128, 128, 128,
128, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
25, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 29,
];
pub static BASE32HEX: Base32 = unsafe { Base32::new_unchecked(BASE32HEX_IMPL) };
const BASE32HEX_IMPL: &[u8] = &[
48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78,
79, 80, 81, 82, 83, 84, 85, 86, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 65, 66, 67, 68, 69, 70,
71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 48, 49, 50, 51, 52, 53, 54, 55,
56, 57, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86,
48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78,
79, 80, 81, 82, 83, 84, 85, 86, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 65, 66, 67, 68, 69, 70,
71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 48, 49, 50, 51, 52, 53, 54, 55,
56, 57, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86,
48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78,
79, 80, 81, 82, 83, 84, 85, 86, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 65, 66, 67, 68, 69, 70,
71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 128, 128, 128, 128, 128, 128,
128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
128, 128, 128, 128, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 128, 128, 128, 130, 128, 128, 128, 10, 11,
12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 128, 128, 128,
128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 61, 29,
];
pub static BASE32HEX_NOPAD: Base32NoPad =
unsafe { Base32NoPad::new_unchecked(BASE32HEX_NOPAD_IMPL) };
const BASE32HEX_NOPAD_IMPL: &[u8] = &[
48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78,
79, 80, 81, 82, 83, 84, 85, 86, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 65, 66, 67, 68, 69, 70,
71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 48, 49, 50, 51, 52, 53, 54, 55,
56, 57, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86,
48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78,
79, 80, 81, 82, 83, 84, 85, 86, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 65, 66, 67, 68, 69, 70,
71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 48, 49, 50, 51, 52, 53, 54, 55,
56, 57, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86,
48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78,
79, 80, 81, 82, 83, 84, 85, 86, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 65, 66, 67, 68, 69, 70,
71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 128, 128, 128, 128, 128, 128,
128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
128, 128, 128, 128, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 128, 128, 128, 128, 128, 128, 128, 10, 11,
12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 128, 128, 128,
128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 29,
];
pub static BASE32_DNSSEC: Base32NoPad = unsafe { Base32NoPad::new_unchecked(BASE32_DNSSEC_IMPL) };
const BASE32_DNSSEC_IMPL: &[u8] = &[
48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107,
108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57,
97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115,
116, 117, 118, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 97, 98, 99, 100, 101, 102, 103, 104,
105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 48, 49, 50, 51, 52, 53,
54, 55, 56, 57, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112,
113, 114, 115, 116, 117, 118, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 97, 98, 99, 100, 101,
102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 48, 49,
50, 51, 52, 53, 54, 55, 56, 57, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109,
110, 111, 112, 113, 114, 115, 116, 117, 118, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 97, 98,
99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117,
118, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106,
107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 128, 128, 128, 128, 128, 128, 128,
128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
128, 128, 128, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 128, 128, 128, 128, 128, 128, 128, 10, 11, 12, 13,
14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 128, 128, 128, 128,
128, 128, 128, 128, 128, 128, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25,
26, 27, 28, 29, 30, 31, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 29,
];
#[allow(clippy::doc_markdown)]
pub static BASE32_DNSCURVE: Base32LsbNoPad =
unsafe { Base32LsbNoPad::new_unchecked(BASE32_DNSCURVE_IMPL) };
const BASE32_DNSCURVE_IMPL: &[u8] = &[
48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 98, 99, 100, 102, 103, 104, 106, 107, 108, 109, 110,
112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57,
98, 99, 100, 102, 103, 104, 106, 107, 108, 109, 110, 112, 113, 114, 115, 116, 117, 118, 119,
120, 121, 122, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 98, 99, 100, 102, 103, 104, 106, 107,
108, 109, 110, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 48, 49, 50, 51, 52, 53,
54, 55, 56, 57, 98, 99, 100, 102, 103, 104, 106, 107, 108, 109, 110, 112, 113, 114, 115, 116,
117, 118, 119, 120, 121, 122, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 98, 99, 100, 102, 103,
104, 106, 107, 108, 109, 110, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 48, 49,
50, 51, 52, 53, 54, 55, 56, 57, 98, 99, 100, 102, 103, 104, 106, 107, 108, 109, 110, 112, 113,
114, 115, 116, 117, 118, 119, 120, 121, 122, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 98, 99,
100, 102, 103, 104, 106, 107, 108, 109, 110, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121,
122, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 98, 99, 100, 102, 103, 104, 106, 107, 108, 109,
110, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 128, 128, 128, 128, 128, 128, 128,
128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
128, 128, 128, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 128, 128, 128, 128, 128, 128, 128, 128, 10, 11,
12, 128, 13, 14, 15, 128, 16, 17, 18, 19, 20, 128, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31,
128, 128, 128, 128, 128, 128, 128, 10, 11, 12, 128, 13, 14, 15, 128, 16, 17, 18, 19, 20, 128,
21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 21,
];
pub static BASE64: Base64 = unsafe { Base64::new_unchecked(BASE64_IMPL) };
const BASE64_IMPL: &[u8] = &[
65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88,
89, 90, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114,
115, 116, 117, 118, 119, 120, 121, 122, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 43, 47, 65, 66,
67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90,
97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115,
116, 117, 118, 119, 120, 121, 122, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 43, 47, 65, 66, 67,
68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 97,
98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116,
117, 118, 119, 120, 121, 122, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 43, 47, 65, 66, 67, 68,
69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 97, 98,
99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117,
118, 119, 120, 121, 122, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 43, 47, 128, 128, 128, 128,
128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
128, 62, 128, 128, 128, 63, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 128, 128, 128, 130, 128,
128, 128, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23,
24, 25, 128, 128, 128, 128, 128, 128, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39,
40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 128, 128, 128, 128, 128, 128, 128, 128, 128,
128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 61, 30,
];
pub static BASE64_NOPAD: Base64NoPad = unsafe { Base64NoPad::new_unchecked(BASE64_NOPAD_IMPL) };
const BASE64_NOPAD_IMPL: &[u8] = &[
65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88,
89, 90, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114,
115, 116, 117, 118, 119, 120, 121, 122, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 43, 47, 65, 66,
67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90,
97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115,
116, 117, 118, 119, 120, 121, 122, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 43, 47, 65, 66, 67,
68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 97,
98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116,
117, 118, 119, 120, 121, 122, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 43, 47, 65, 66, 67, 68,
69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 97, 98,
99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117,
118, 119, 120, 121, 122, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 43, 47, 128, 128, 128, 128,
128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
128, 62, 128, 128, 128, 63, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 128, 128, 128, 128, 128,
128, 128, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23,
24, 25, 128, 128, 128, 128, 128, 128, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39,
40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 128, 128, 128, 128, 128, 128, 128, 128, 128,
128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 30,
];
pub static BASE64_MIME: Base64Wrap = unsafe { Base64Wrap::new_unchecked(BASE64_MIME_IMPL) };
const BASE64_MIME_IMPL: &[u8] = &[
65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88,
89, 90, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114,
115, 116, 117, 118, 119, 120, 121, 122, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 43, 47, 65, 66,
67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90,
97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115,
116, 117, 118, 119, 120, 121, 122, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 43, 47, 65, 66, 67,
68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 97,
98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116,
117, 118, 119, 120, 121, 122, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 43, 47, 65, 66, 67, 68,
69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 97, 98,
99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117,
118, 119, 120, 121, 122, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 43, 47, 128, 128, 128, 128,
128, 128, 128, 128, 128, 128, 129, 128, 128, 129, 128, 128, 128, 128, 128, 128, 128, 128, 128,
128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
128, 62, 128, 128, 128, 63, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 128, 128, 128, 130, 128,
128, 128, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23,
24, 25, 128, 128, 128, 128, 128, 128, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39,
40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 128, 128, 128, 128, 128, 128, 128, 128, 128,
128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 61, 30, 76, 13, 10,
];
pub static BASE64_MIME_PERMISSIVE: Base64Wrap =
unsafe { Base64Wrap::new_unchecked(BASE64_MIME_PERMISSIVE_IMPL) };
const BASE64_MIME_PERMISSIVE_IMPL: &[u8] = &[
65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88,
89, 90, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114,
115, 116, 117, 118, 119, 120, 121, 122, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 43, 47, 65, 66,
67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90,
97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115,
116, 117, 118, 119, 120, 121, 122, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 43, 47, 65, 66, 67,
68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 97,
98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116,
117, 118, 119, 120, 121, 122, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 43, 47, 65, 66, 67, 68,
69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 97, 98,
99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117,
118, 119, 120, 121, 122, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 43, 47, 128, 128, 128, 128,
128, 128, 128, 128, 128, 128, 129, 128, 128, 129, 128, 128, 128, 128, 128, 128, 128, 128, 128,
128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
128, 62, 128, 128, 128, 63, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 128, 128, 128, 130, 128,
128, 128, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23,
24, 25, 128, 128, 128, 128, 128, 128, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39,
40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 128, 128, 128, 128, 128, 128, 128, 128, 128,
128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 61, 14, 76, 13, 10,
];
pub static BASE64URL: Base64 = unsafe { Base64::new_unchecked(BASE64URL_IMPL) };
const BASE64URL_IMPL: &[u8] = &[
65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88,
89, 90, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114,
115, 116, 117, 118, 119, 120, 121, 122, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 45, 95, 65, 66,
67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90,
97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115,
116, 117, 118, 119, 120, 121, 122, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 45, 95, 65, 66, 67,
68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 97,
98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116,
117, 118, 119, 120, 121, 122, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 45, 95, 65, 66, 67, 68,
69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 97, 98,
99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117,
118, 119, 120, 121, 122, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 45, 95, 128, 128, 128, 128,
128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
128, 128, 128, 62, 128, 128, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 128, 128, 128, 130, 128,
128, 128, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23,
24, 25, 128, 128, 128, 128, 63, 128, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39,
40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 128, 128, 128, 128, 128, 128, 128, 128, 128,
128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 61, 30,
];
pub static BASE64URL_NOPAD: Base64NoPad =
unsafe { Base64NoPad::new_unchecked(BASE64URL_NOPAD_IMPL) };
const BASE64URL_NOPAD_IMPL: &[u8] = &[
65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88,
89, 90, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114,
115, 116, 117, 118, 119, 120, 121, 122, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 45, 95, 65, 66,
67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90,
97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115,
116, 117, 118, 119, 120, 121, 122, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 45, 95, 65, 66, 67,
68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 97,
98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116,
117, 118, 119, 120, 121, 122, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 45, 95, 65, 66, 67, 68,
69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 97, 98,
99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117,
118, 119, 120, 121, 122, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 45, 95, 128, 128, 128, 128,
128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
128, 128, 128, 62, 128, 128, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 128, 128, 128, 128, 128,
128, 128, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23,
24, 25, 128, 128, 128, 128, 63, 128, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39,
40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 128, 128, 128, 128, 128, 128, 128, 128, 128,
128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 30,
];