1#![no_std]
147#![cfg_attr(docsrs, feature(doc_cfg))]
148
149#[cfg(feature = "alloc")]
150extern crate alloc;
151#[cfg(feature = "std")]
152extern crate std;
153
154#[cfg(feature = "alloc")]
155use alloc::borrow::{Cow, ToOwned};
156#[cfg(feature = "alloc")]
157use alloc::string::String;
158#[cfg(feature = "alloc")]
159use alloc::vec;
160#[cfg(feature = "alloc")]
161use alloc::vec::Vec;
162use core::convert::TryInto;
163use core::debug_assert as safety_assert;
164
165macro_rules! check {
166 ($e: expr, $c: expr) => {
167 if !$c {
168 return Err($e);
169 }
170 };
171}
172
173trait Static<T: Copy>: Copy {
174 fn val(self) -> T;
175}
176
177macro_rules! define {
178 ($name: ident: $type: ty = $val: expr) => {
179 #[derive(Copy, Clone)]
180 struct $name;
181 impl Static<$type> for $name {
182 fn val(self) -> $type {
183 $val
184 }
185 }
186 };
187}
188
189define!(Bf: bool = false);
190define!(Bt: bool = true);
191define!(N1: usize = 1);
192define!(N2: usize = 2);
193define!(N3: usize = 3);
194define!(N4: usize = 4);
195define!(N5: usize = 5);
196define!(N6: usize = 6);
197
198#[derive(Copy, Clone)]
199struct On;
200
201impl<T: Copy> Static<Option<T>> for On {
202 fn val(self) -> Option<T> {
203 None
204 }
205}
206
207#[derive(Copy, Clone)]
208struct Os<T>(T);
209
210impl<T: Copy> Static<Option<T>> for Os<T> {
211 fn val(self) -> Option<T> {
212 Some(self.0)
213 }
214}
215
216macro_rules! dispatch {
217 (let $var: ident: bool = $val: expr; $($body: tt)*) => {
218 if $val {
219 let $var = Bt; dispatch!($($body)*)
220 } else {
221 let $var = Bf; dispatch!($($body)*)
222 }
223 };
224 (let $var: ident: usize = $val: expr; $($body: tt)*) => {
225 match $val {
226 1 => { let $var = N1; dispatch!($($body)*) },
227 2 => { let $var = N2; dispatch!($($body)*) },
228 3 => { let $var = N3; dispatch!($($body)*) },
229 4 => { let $var = N4; dispatch!($($body)*) },
230 5 => { let $var = N5; dispatch!($($body)*) },
231 6 => { let $var = N6; dispatch!($($body)*) },
232 _ => panic!(),
233 }
234 };
235 (let $var: ident: Option<$type: ty> = $val: expr; $($body: tt)*) => {
236 match $val {
237 None => { let $var = On; dispatch!($($body)*) },
238 Some(x) => { let $var = Os(x); dispatch!($($body)*) },
239 }
240 };
241 ($body: expr) => { $body };
242}
243
244fn chunk_unchecked<T>(x: &[T], n: usize, i: usize) -> &[T] {
245 safety_assert!((i + 1) * n <= x.len());
246 unsafe { core::slice::from_raw_parts(x.as_ptr().add(n * i), n) }
248}
249
250fn chunk_mut_unchecked<T>(x: &mut [T], n: usize, i: usize) -> &mut [T] {
251 safety_assert!((i + 1) * n <= x.len());
252 unsafe { core::slice::from_raw_parts_mut(x.as_mut_ptr().add(n * i), n) }
254}
255
256fn div_ceil(x: usize, m: usize) -> usize {
257 (x + m - 1) / m
258}
259
260fn floor(x: usize, m: usize) -> usize {
261 x / m * m
262}
263
264#[inline]
265fn vectorize<F: FnMut(usize)>(n: usize, bs: usize, mut f: F) {
266 for k in 0 .. n / bs {
267 for i in k * bs .. (k + 1) * bs {
268 f(i);
269 }
270 }
271 for i in floor(n, bs) .. n {
272 f(i);
273 }
274}
275
276#[derive(Debug, Copy, Clone, PartialEq, Eq)]
278pub enum DecodeKind {
279 Length,
281
282 Symbol,
284
285 Trailing,
287
288 Padding,
290}
291
292impl core::fmt::Display for DecodeKind {
293 fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
294 let description = match self {
295 DecodeKind::Length => "invalid length",
296 DecodeKind::Symbol => "invalid symbol",
297 DecodeKind::Trailing => "non-zero trailing bits",
298 DecodeKind::Padding => "invalid padding length",
299 };
300 write!(f, "{}", description)
301 }
302}
303
304#[derive(Debug, Copy, Clone, PartialEq, Eq)]
306pub struct DecodeError {
307 pub position: usize,
311
312 pub kind: DecodeKind,
314}
315
316#[cfg(feature = "std")]
317impl std::error::Error for DecodeError {}
318
319impl core::fmt::Display for DecodeError {
320 fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
321 write!(f, "{} at {}", self.kind, self.position)
322 }
323}
324
325#[derive(Debug, Copy, Clone, PartialEq, Eq)]
327pub struct DecodePartial {
328 pub read: usize,
332
333 pub written: usize,
337
338 pub error: DecodeError,
340}
341
342const INVALID: u8 = 128;
343const IGNORE: u8 = 129;
344const PADDING: u8 = 130;
345
346fn order(msb: bool, n: usize, i: usize) -> usize {
347 if msb {
348 n - 1 - i
349 } else {
350 i
351 }
352}
353
354#[inline]
355fn enc(bit: usize) -> usize {
356 match bit {
357 1 | 2 | 4 => 1,
358 3 | 6 => 3,
359 5 => 5,
360 _ => unreachable!(),
361 }
362}
363
364#[inline]
365fn dec(bit: usize) -> usize {
366 enc(bit) * 8 / bit
367}
368
369fn encode_len<B: Static<usize>>(bit: B, len: usize) -> usize {
370 div_ceil(8 * len, bit.val())
371}
372
373fn encode_block<B: Static<usize>, M: Static<bool>>(
374 bit: B, msb: M, symbols: &[u8; 256], input: &[u8], output: &mut [u8],
375) {
376 debug_assert!(input.len() <= enc(bit.val()));
377 debug_assert_eq!(output.len(), encode_len(bit, input.len()));
378 let bit = bit.val();
379 let msb = msb.val();
380 let mut x = 0u64;
381 for (i, input) in input.iter().enumerate() {
382 x |= u64::from(*input) << (8 * order(msb, enc(bit), i));
383 }
384 for (i, output) in output.iter_mut().enumerate() {
385 let y = x >> (bit * order(msb, dec(bit), i));
386 *output = symbols[(y & 0xff) as usize];
387 }
388}
389
390fn encode_mut<B: Static<usize>, M: Static<bool>>(
391 bit: B, msb: M, symbols: &[u8; 256], input: &[u8], output: &mut [u8],
392) {
393 debug_assert_eq!(output.len(), encode_len(bit, input.len()));
394 let enc = enc(bit.val());
395 let dec = dec(bit.val());
396 let n = input.len() / enc;
397 let bs = match bit.val() {
398 5 => 2,
399 6 => 4,
400 _ => 1,
401 };
402 vectorize(n, bs, |i| {
403 let input = chunk_unchecked(input, enc, i);
404 let output = chunk_mut_unchecked(output, dec, i);
405 encode_block(bit, msb, symbols, input, output);
406 });
407 encode_block(bit, msb, symbols, &input[enc * n ..], &mut output[dec * n ..]);
408}
409
410fn decode_block<B: Static<usize>, M: Static<bool>>(
413 bit: B, msb: M, values: &[u8; 256], input: &[u8], output: &mut [u8],
414) -> Result<(), usize> {
415 debug_assert!(output.len() <= enc(bit.val()));
416 debug_assert_eq!(input.len(), encode_len(bit, output.len()));
417 let bit = bit.val();
418 let msb = msb.val();
419 let mut x = 0u64;
420 for j in 0 .. input.len() {
421 let y = values[input[j] as usize];
422 check!(j, y < 1 << bit);
423 x |= u64::from(y) << (bit * order(msb, dec(bit), j));
424 }
425 for (j, output) in output.iter_mut().enumerate() {
426 *output = ((x >> (8 * order(msb, enc(bit), j))) & 0xff) as u8;
427 }
428 Ok(())
429}
430
431fn decode_mut<B: Static<usize>, M: Static<bool>>(
435 bit: B, msb: M, values: &[u8; 256], input: &[u8], output: &mut [u8],
436) -> Result<(), usize> {
437 debug_assert_eq!(input.len(), encode_len(bit, output.len()));
438 let enc = enc(bit.val());
439 let dec = dec(bit.val());
440 let n = input.len() / dec;
441 for i in 0 .. n {
442 let input = chunk_unchecked(input, dec, i);
443 let output = chunk_mut_unchecked(output, enc, i);
444 decode_block(bit, msb, values, input, output).map_err(|e| dec * i + e)?;
445 }
446 decode_block(bit, msb, values, &input[dec * n ..], &mut output[enc * n ..])
447 .map_err(|e| dec * n + e)
448}
449
450fn check_trail<B: Static<usize>, M: Static<bool>>(
452 bit: B, msb: M, ctb: bool, values: &[u8; 256], input: &[u8],
453) -> Result<(), ()> {
454 if 8 % bit.val() == 0 || !ctb {
455 return Ok(());
456 }
457 let trail = bit.val() * input.len() % 8;
458 if trail == 0 {
459 return Ok(());
460 }
461 let mut mask = (1 << trail) - 1;
462 if !msb.val() {
463 mask <<= bit.val() - trail;
464 }
465 check!((), values[input[input.len() - 1] as usize] & mask == 0);
466 Ok(())
467}
468
469fn check_pad<B: Static<usize>>(bit: B, values: &[u8; 256], input: &[u8]) -> Result<usize, usize> {
472 let bit = bit.val();
473 debug_assert_eq!(input.len(), dec(bit));
474 let is_pad = |x: &&u8| values[**x as usize] == PADDING;
475 let count = input.iter().rev().take_while(is_pad).count();
476 let len = input.len() - count;
477 check!(len, len > 0 && bit * len % 8 < bit);
478 Ok(len)
479}
480
481fn encode_base_len<B: Static<usize>>(bit: B, len: usize) -> usize {
482 encode_len(bit, len)
483}
484
485fn encode_base<B: Static<usize>, M: Static<bool>>(
486 bit: B, msb: M, symbols: &[u8; 256], input: &[u8], output: &mut [u8],
487) {
488 debug_assert_eq!(output.len(), encode_base_len(bit, input.len()));
489 encode_mut(bit, msb, symbols, input, output);
490}
491
492fn encode_pad_len<B: Static<usize>, P: Static<Option<u8>>>(bit: B, pad: P, len: usize) -> usize {
493 match pad.val() {
494 None => encode_base_len(bit, len),
495 Some(_) => div_ceil(len, enc(bit.val())) * dec(bit.val()),
496 }
497}
498
499fn encode_pad<B: Static<usize>, M: Static<bool>, P: Static<Option<u8>>>(
500 bit: B, msb: M, symbols: &[u8; 256], spad: P, input: &[u8], output: &mut [u8],
501) {
502 let pad = match spad.val() {
503 None => return encode_base(bit, msb, symbols, input, output),
504 Some(pad) => pad,
505 };
506 debug_assert_eq!(output.len(), encode_pad_len(bit, spad, input.len()));
507 let olen = encode_base_len(bit, input.len());
508 encode_base(bit, msb, symbols, input, &mut output[.. olen]);
509 for output in output.iter_mut().skip(olen) {
510 *output = pad;
511 }
512}
513
514fn encode_wrap_len<
515 'a,
516 B: Static<usize>,
517 P: Static<Option<u8>>,
518 W: Static<Option<(usize, &'a [u8])>>,
519>(
520 bit: B, pad: P, wrap: W, ilen: usize,
521) -> usize {
522 let olen = encode_pad_len(bit, pad, ilen);
523 match wrap.val() {
524 None => olen,
525 Some((col, end)) => olen + end.len() * div_ceil(olen, col),
526 }
527}
528
529fn encode_wrap_mut<
530 'a,
531 B: Static<usize>,
532 M: Static<bool>,
533 P: Static<Option<u8>>,
534 W: Static<Option<(usize, &'a [u8])>>,
535>(
536 bit: B, msb: M, symbols: &[u8; 256], pad: P, wrap: W, input: &[u8], output: &mut [u8],
537) {
538 let (col, end) = match wrap.val() {
539 None => return encode_pad(bit, msb, symbols, pad, input, output),
540 Some((col, end)) => (col, end),
541 };
542 debug_assert_eq!(output.len(), encode_wrap_len(bit, pad, wrap, input.len()));
543 debug_assert_eq!(col % dec(bit.val()), 0);
544 let col = col / dec(bit.val());
545 let enc = col * enc(bit.val());
546 let dec = col * dec(bit.val()) + end.len();
547 let olen = dec - end.len();
548 let n = input.len() / enc;
549 for i in 0 .. n {
550 let input = chunk_unchecked(input, enc, i);
551 let output = chunk_mut_unchecked(output, dec, i);
552 encode_base(bit, msb, symbols, input, &mut output[.. olen]);
553 output[olen ..].copy_from_slice(end);
554 }
555 if input.len() > enc * n {
556 let olen = dec * n + encode_pad_len(bit, pad, input.len() - enc * n);
557 encode_pad(bit, msb, symbols, pad, &input[enc * n ..], &mut output[dec * n .. olen]);
558 output[olen ..].copy_from_slice(end);
559 }
560}
561
562fn decode_wrap_len<B: Static<usize>, P: Static<bool>>(
564 bit: B, pad: P, len: usize,
565) -> (usize, usize) {
566 let bit = bit.val();
567 if pad.val() {
568 (floor(len, dec(bit)), len / dec(bit) * enc(bit))
569 } else {
570 let trail = bit * len % 8;
571 (len - trail / bit, bit * len / 8)
572 }
573}
574
575fn decode_pad_len<B: Static<usize>, P: Static<bool>>(
578 bit: B, pad: P, len: usize,
579) -> Result<usize, DecodeError> {
580 let (ilen, olen) = decode_wrap_len(bit, pad, len);
581 check!(DecodeError { position: ilen, kind: DecodeKind::Length }, ilen == len);
582 Ok(olen)
583}
584
585fn decode_base_len<B: Static<usize>>(bit: B, len: usize) -> Result<usize, DecodeError> {
588 decode_pad_len(bit, Bf, len)
589}
590
591fn decode_base_mut<B: Static<usize>, M: Static<bool>>(
595 bit: B, msb: M, ctb: bool, values: &[u8; 256], input: &[u8], output: &mut [u8],
596) -> Result<usize, DecodePartial> {
597 debug_assert_eq!(Ok(output.len()), decode_base_len(bit, input.len()));
598 let fail = |pos, kind| DecodePartial {
599 read: pos / dec(bit.val()) * dec(bit.val()),
600 written: pos / dec(bit.val()) * enc(bit.val()),
601 error: DecodeError { position: pos, kind },
602 };
603 decode_mut(bit, msb, values, input, output).map_err(|pos| fail(pos, DecodeKind::Symbol))?;
604 check_trail(bit, msb, ctb, values, input)
605 .map_err(|()| fail(input.len() - 1, DecodeKind::Trailing))?;
606 Ok(output.len())
607}
608
609fn decode_pad_mut<B: Static<usize>, M: Static<bool>, P: Static<bool>>(
615 bit: B, msb: M, ctb: bool, values: &[u8; 256], pad: P, input: &[u8], output: &mut [u8],
616) -> Result<usize, DecodePartial> {
617 if !pad.val() {
618 return decode_base_mut(bit, msb, ctb, values, input, output);
619 }
620 debug_assert_eq!(Ok(output.len()), decode_pad_len(bit, pad, input.len()));
621 let enc = enc(bit.val());
622 let dec = dec(bit.val());
623 let mut inpos = 0;
624 let mut outpos = 0;
625 let mut outend = output.len();
626 while inpos < input.len() {
627 match decode_base_mut(
628 bit,
629 msb,
630 ctb,
631 values,
632 &input[inpos ..],
633 &mut output[outpos .. outend],
634 ) {
635 Ok(written) => {
636 if cfg!(debug_assertions) {
637 inpos = input.len();
638 }
639 outpos += written;
640 break;
641 }
642 Err(partial) => {
643 inpos += partial.read;
644 outpos += partial.written;
645 }
646 }
647 let inlen =
648 check_pad(bit, values, &input[inpos .. inpos + dec]).map_err(|pos| DecodePartial {
649 read: inpos,
650 written: outpos,
651 error: DecodeError { position: inpos + pos, kind: DecodeKind::Padding },
652 })?;
653 let outlen = decode_base_len(bit, inlen).unwrap();
654 let written = decode_base_mut(
655 bit,
656 msb,
657 ctb,
658 values,
659 &input[inpos .. inpos + inlen],
660 &mut output[outpos .. outpos + outlen],
661 )
662 .map_err(|partial| {
663 debug_assert_eq!(partial.read, 0);
664 debug_assert_eq!(partial.written, 0);
665 DecodePartial {
666 read: inpos,
667 written: outpos,
668 error: DecodeError {
669 position: inpos + partial.error.position,
670 kind: partial.error.kind,
671 },
672 }
673 })?;
674 debug_assert_eq!(written, outlen);
675 inpos += dec;
676 outpos += outlen;
677 outend -= enc - outlen;
678 }
679 debug_assert_eq!(inpos, input.len());
680 debug_assert_eq!(outpos, outend);
681 Ok(outend)
682}
683
684fn skip_ignore(values: &[u8; 256], input: &[u8], mut inpos: usize) -> usize {
685 while inpos < input.len() && values[input[inpos] as usize] == IGNORE {
686 inpos += 1;
687 }
688 inpos
689}
690
691fn decode_wrap_block<B: Static<usize>, M: Static<bool>, P: Static<bool>>(
698 bit: B, msb: M, ctb: bool, values: &[u8; 256], pad: P, input: &[u8], output: &mut [u8],
699) -> Result<(usize, usize), DecodeError> {
700 let dec = dec(bit.val());
701 let mut buf = [0u8; 8];
702 let mut shift = [0usize; 8];
703 let mut bufpos = 0;
704 let mut inpos = 0;
705 while bufpos < dec {
706 inpos = skip_ignore(values, input, inpos);
707 if inpos == input.len() {
708 break;
709 }
710 shift[bufpos] = inpos;
711 buf[bufpos] = input[inpos];
712 bufpos += 1;
713 inpos += 1;
714 }
715 let olen = decode_pad_len(bit, pad, bufpos).map_err(|mut e| {
716 e.position = shift[e.position];
717 e
718 })?;
719 let written = decode_pad_mut(bit, msb, ctb, values, pad, &buf[.. bufpos], &mut output[.. olen])
720 .map_err(|partial| {
721 debug_assert_eq!(partial.read, 0);
722 debug_assert_eq!(partial.written, 0);
723 DecodeError { position: shift[partial.error.position], kind: partial.error.kind }
724 })?;
725 Ok((inpos, written))
726}
727
728#[allow(clippy::too_many_arguments)]
735fn decode_wrap_mut<B: Static<usize>, M: Static<bool>, P: Static<bool>, I: Static<bool>>(
736 bit: B, msb: M, ctb: bool, values: &[u8; 256], pad: P, has_ignore: I, input: &[u8],
737 output: &mut [u8],
738) -> Result<usize, DecodePartial> {
739 if !has_ignore.val() {
740 return decode_pad_mut(bit, msb, ctb, values, pad, input, output);
741 }
742 debug_assert_eq!(output.len(), decode_wrap_len(bit, pad, input.len()).1);
743 let mut inpos = 0;
744 let mut outpos = 0;
745 while inpos < input.len() {
746 let (inlen, outlen) = decode_wrap_len(bit, pad, input.len() - inpos);
747 match decode_pad_mut(
748 bit,
749 msb,
750 ctb,
751 values,
752 pad,
753 &input[inpos .. inpos + inlen],
754 &mut output[outpos .. outpos + outlen],
755 ) {
756 Ok(written) => {
757 inpos += inlen;
758 outpos += written;
759 break;
760 }
761 Err(partial) => {
762 inpos += partial.read;
763 outpos += partial.written;
764 }
765 }
766 let (ipos, opos) =
767 decode_wrap_block(bit, msb, ctb, values, pad, &input[inpos ..], &mut output[outpos ..])
768 .map_err(|mut error| {
769 error.position += inpos;
770 DecodePartial { read: inpos, written: outpos, error }
771 })?;
772 inpos += ipos;
773 outpos += opos;
774 }
775 let inpos = skip_ignore(values, input, inpos);
776 if inpos == input.len() {
777 Ok(outpos)
778 } else {
779 Err(DecodePartial {
780 read: inpos,
781 written: outpos,
782 error: DecodeError { position: inpos, kind: DecodeKind::Length },
783 })
784 }
785}
786
787#[derive(Debug, Copy, Clone, PartialEq, Eq)]
813#[cfg(feature = "alloc")]
814pub enum BitOrder {
815 MostSignificantFirst,
824
825 LeastSignificantFirst,
839}
840#[cfg(feature = "alloc")]
841use crate::BitOrder::*;
842
843#[doc(hidden)]
844#[cfg(feature = "alloc")]
845pub type InternalEncoding = Cow<'static, [u8]>;
846
847#[doc(hidden)]
848#[cfg(not(feature = "alloc"))]
849pub type InternalEncoding = &'static [u8];
850
851#[derive(Debug, Clone, PartialEq, Eq)]
874#[repr(transparent)]
875pub struct Encoding(#[doc(hidden)] pub InternalEncoding);
876
877#[derive(Debug, Clone)]
884#[cfg(feature = "alloc")]
885pub struct Translate {
886 pub from: String,
888
889 pub to: String,
891}
892
893#[derive(Debug, Clone)]
897#[cfg(feature = "alloc")]
898pub struct Wrap {
899 pub width: usize,
909
910 pub separator: String,
914}
915
916#[derive(Debug, Clone)]
1153#[cfg(feature = "alloc")]
1154pub struct Specification {
1155 pub symbols: String,
1160
1161 pub bit_order: BitOrder,
1165
1166 pub check_trailing_bits: bool,
1171
1172 pub padding: Option<char>,
1177
1178 pub ignore: String,
1183
1184 pub wrap: Wrap,
1189
1190 pub translate: Translate,
1197}
1198
1199#[cfg(feature = "alloc")]
1200impl Default for Specification {
1201 fn default() -> Self {
1202 Self::new()
1203 }
1204}
1205
1206impl Encoding {
1207 fn sym(&self) -> &[u8; 256] {
1208 self.0[0 .. 256].try_into().unwrap()
1209 }
1210
1211 fn val(&self) -> &[u8; 256] {
1212 self.0[256 .. 512].try_into().unwrap()
1213 }
1214
1215 fn pad(&self) -> Option<u8> {
1216 if self.0[512] < 128 {
1217 Some(self.0[512])
1218 } else {
1219 None
1220 }
1221 }
1222
1223 fn ctb(&self) -> bool {
1224 self.0[513] & 0x10 != 0
1225 }
1226
1227 fn msb(&self) -> bool {
1228 self.0[513] & 0x8 != 0
1229 }
1230
1231 fn bit(&self) -> usize {
1232 (self.0[513] & 0x7) as usize
1233 }
1234
1235 fn block_len(&self) -> (usize, usize) {
1237 let bit = self.bit();
1238 match self.wrap() {
1239 Some((col, end)) => (col / dec(bit) * enc(bit), col + end.len()),
1240 None => (enc(bit), dec(bit)),
1241 }
1242 }
1243
1244 fn wrap(&self) -> Option<(usize, &[u8])> {
1245 if self.0.len() <= 515 {
1246 return None;
1247 }
1248 Some((self.0[514] as usize, &self.0[515 ..]))
1249 }
1250
1251 fn has_ignore(&self) -> bool {
1252 self.0.len() >= 515
1253 }
1254
1255 #[must_use]
1277 pub fn encode_len(&self, len: usize) -> usize {
1278 assert!(len <= usize::MAX / 512);
1279 dispatch! {
1280 let bit: usize = self.bit();
1281 let pad: Option<u8> = self.pad();
1282 let wrap: Option<(usize, &[u8])> = self.wrap();
1283 encode_wrap_len(bit, pad, wrap, len)
1284 }
1285 }
1286
1287 #[must_use]
1293 pub fn encode_align(&self) -> usize {
1294 let bit = self.bit();
1295 match self.wrap() {
1296 None => enc(bit),
1297 Some((col, _)) => col * bit / 8,
1298 }
1299 }
1300
1301 #[allow(clippy::cognitive_complexity)]
1321 pub fn encode_mut(&self, input: &[u8], output: &mut [u8]) {
1322 assert_eq!(output.len(), self.encode_len(input.len()));
1323 dispatch! {
1324 let bit: usize = self.bit();
1325 let msb: bool = self.msb();
1326 let pad: Option<u8> = self.pad();
1327 let wrap: Option<(usize, &[u8])> = self.wrap();
1328 encode_wrap_mut(bit, msb, self.sym(), pad, wrap, input, output)
1329 }
1330 }
1331
1332 pub fn encode_mut_str<'a>(&self, input: &[u8], output: &'a mut [u8]) -> &'a str {
1354 self.encode_mut(input, output);
1355 safety_assert!(output.is_ascii());
1356 unsafe { core::str::from_utf8_unchecked(output) }
1358 }
1359
1360 #[cfg(feature = "alloc")]
1373 pub fn encode_append(&self, input: &[u8], output: &mut String) {
1374 let output = unsafe { output.as_mut_vec() };
1376 let output_len = output.len();
1377 output.resize(output_len + self.encode_len(input.len()), 0u8);
1378 self.encode_mut(input, &mut output[output_len ..]);
1379 safety_assert!(output[output_len ..].is_ascii());
1380 }
1381
1382 #[cfg(feature = "alloc")]
1386 pub fn new_encoder<'a>(&'a self, output: &'a mut String) -> Encoder<'a> {
1387 Encoder::new(self, output)
1388 }
1389
1390 pub fn encode_write(
1399 &self, input: &[u8], output: &mut impl core::fmt::Write,
1400 ) -> core::fmt::Result {
1401 self.encode_write_buffer(input, output, &mut [0; 1024])
1402 }
1403
1404 pub fn encode_write_buffer(
1414 &self, input: &[u8], output: &mut impl core::fmt::Write, buffer: &mut [u8],
1415 ) -> core::fmt::Result {
1416 assert!(510 <= buffer.len());
1417 let (enc, dec) = self.block_len();
1418 for input in input.chunks(buffer.len() / dec * enc) {
1419 let buffer = &mut buffer[.. self.encode_len(input.len())];
1420 self.encode_mut(input, buffer);
1421 safety_assert!(buffer.is_ascii());
1422 output.write_str(unsafe { core::str::from_utf8_unchecked(buffer) })?;
1424 }
1425 Ok(())
1426 }
1427
1428 #[must_use]
1440 pub fn encode_display<'a>(&'a self, input: &'a [u8]) -> Display<'a> {
1441 Display { encoding: self, input }
1442 }
1443
1444 #[cfg(feature = "alloc")]
1453 #[must_use]
1454 pub fn encode(&self, input: &[u8]) -> String {
1455 let mut output = vec![0u8; self.encode_len(input.len())];
1456 self.encode_mut(input, &mut output);
1457 safety_assert!(output.is_ascii());
1458 unsafe { String::from_utf8_unchecked(output) }
1460 }
1461
1462 pub fn decode_len(&self, len: usize) -> Result<usize, DecodeError> {
1497 assert!(len <= usize::MAX / 8);
1498 let (ilen, olen) = dispatch! {
1499 let bit: usize = self.bit();
1500 let pad: bool = self.pad().is_some();
1501 decode_wrap_len(bit, pad, len)
1502 };
1503 check!(
1504 DecodeError { position: ilen, kind: DecodeKind::Length },
1505 self.has_ignore() || len == ilen
1506 );
1507 Ok(olen)
1508 }
1509
1510 #[allow(clippy::cognitive_complexity)]
1548 pub fn decode_mut(&self, input: &[u8], output: &mut [u8]) -> Result<usize, DecodePartial> {
1549 assert_eq!(Ok(output.len()), self.decode_len(input.len()));
1550 dispatch! {
1551 let bit: usize = self.bit();
1552 let msb: bool = self.msb();
1553 let pad: bool = self.pad().is_some();
1554 let has_ignore: bool = self.has_ignore();
1555 decode_wrap_mut(bit, msb, self.ctb(), self.val(), pad, has_ignore,
1556 input, output)
1557 }
1558 }
1559
1560 #[cfg(feature = "alloc")]
1590 pub fn decode(&self, input: &[u8]) -> Result<Vec<u8>, DecodeError> {
1591 let mut output = vec![0u8; self.decode_len(input.len())?];
1592 let len = self.decode_mut(input, &mut output).map_err(|partial| partial.error)?;
1593 output.truncate(len);
1594 Ok(output)
1595 }
1596
1597 #[must_use]
1599 pub fn bit_width(&self) -> usize {
1600 self.bit()
1601 }
1602
1603 #[must_use]
1612 pub fn is_canonical(&self) -> bool {
1613 if !self.ctb() {
1614 return false;
1615 }
1616 let bit = self.bit();
1617 let sym = self.sym();
1618 let val = self.val();
1619 for i in 0 .. 256 {
1620 if val[i] == INVALID {
1621 continue;
1622 }
1623 if val[i] >= 1 << bit {
1624 return false;
1625 }
1626 if sym[val[i] as usize] as usize != i {
1627 return false;
1628 }
1629 }
1630 true
1631 }
1632
1633 #[allow(clippy::missing_panics_doc)] #[cfg(feature = "alloc")]
1636 #[must_use]
1637 pub fn specification(&self) -> Specification {
1638 let mut specification = Specification::new();
1639 specification
1640 .symbols
1641 .push_str(core::str::from_utf8(&self.sym()[0 .. 1 << self.bit()]).unwrap());
1642 specification.bit_order =
1643 if self.msb() { MostSignificantFirst } else { LeastSignificantFirst };
1644 specification.check_trailing_bits = self.ctb();
1645 if let Some(pad) = self.pad() {
1646 specification.padding = Some(pad as char);
1647 }
1648 for i in 0 .. 128u8 {
1649 if self.val()[i as usize] != IGNORE {
1650 continue;
1651 }
1652 specification.ignore.push(i as char);
1653 }
1654 if let Some((col, end)) = self.wrap() {
1655 specification.wrap.width = col;
1656 specification.wrap.separator = core::str::from_utf8(end).unwrap().to_owned();
1657 }
1658 for i in 0 .. 128u8 {
1659 let canonical = if self.val()[i as usize] < 1 << self.bit() {
1660 self.sym()[self.val()[i as usize] as usize]
1661 } else if self.val()[i as usize] == PADDING {
1662 self.pad().unwrap()
1663 } else {
1664 continue;
1665 };
1666 if i == canonical {
1667 continue;
1668 }
1669 specification.translate.from.push(i as char);
1670 specification.translate.to.push(canonical as char);
1671 }
1672 specification
1673 }
1674
1675 #[doc(hidden)]
1676 #[must_use]
1677 pub const fn internal_new(implementation: &'static [u8]) -> Encoding {
1678 #[cfg(feature = "alloc")]
1679 let encoding = Encoding(Cow::Borrowed(implementation));
1680 #[cfg(not(feature = "alloc"))]
1681 let encoding = Encoding(implementation);
1682 encoding
1683 }
1684
1685 #[doc(hidden)]
1686 #[must_use]
1687 pub fn internal_implementation(&self) -> &[u8] {
1688 &self.0
1689 }
1690}
1691
1692#[derive(Debug)]
1713#[cfg(feature = "alloc")]
1714pub struct Encoder<'a> {
1715 encoding: &'a Encoding,
1716 output: &'a mut String,
1717 buffer: [u8; 255],
1718 length: u8,
1719}
1720
1721#[cfg(feature = "alloc")]
1722impl Drop for Encoder<'_> {
1723 fn drop(&mut self) {
1724 self.encoding.encode_append(&self.buffer[.. self.length as usize], self.output);
1725 }
1726}
1727
1728#[cfg(feature = "alloc")]
1729impl<'a> Encoder<'a> {
1730 fn new(encoding: &'a Encoding, output: &'a mut String) -> Self {
1731 Encoder { encoding, output, buffer: [0; 255], length: 0 }
1732 }
1733
1734 pub fn append(&mut self, mut input: &[u8]) {
1736 #[allow(clippy::cast_possible_truncation)] let max = self.encoding.block_len().0 as u8;
1738 if self.length != 0 {
1739 let len = self.length;
1740 #[allow(clippy::cast_possible_truncation)] let add = core::cmp::min((max - len) as usize, input.len()) as u8;
1742 self.buffer[len as usize ..][.. add as usize].copy_from_slice(&input[.. add as usize]);
1743 self.length += add;
1744 input = &input[add as usize ..];
1745 if self.length != max {
1746 debug_assert!(self.length < max);
1747 debug_assert!(input.is_empty());
1748 return;
1749 }
1750 self.encoding.encode_append(&self.buffer[.. max as usize], self.output);
1751 self.length = 0;
1752 }
1753 let len = floor(input.len(), max as usize);
1754 self.encoding.encode_append(&input[.. len], self.output);
1755 input = &input[len ..];
1756 #[allow(clippy::cast_possible_truncation)] let len = input.len() as u8;
1758 self.buffer[.. len as usize].copy_from_slice(input);
1759 self.length = len;
1760 }
1761
1762 pub fn finalize(self) {}
1767}
1768
1769#[derive(Debug)]
1771pub struct Display<'a> {
1772 encoding: &'a Encoding,
1773 input: &'a [u8],
1774}
1775
1776impl core::fmt::Display for Display<'_> {
1777 fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
1778 self.encoding.encode_write(self.input, f)
1779 }
1780}
1781
1782#[derive(Debug, Copy, Clone)]
1783#[cfg(feature = "alloc")]
1784enum SpecificationErrorImpl {
1785 BadSize,
1786 NotAscii,
1787 Duplicate(u8),
1788 ExtraPadding,
1789 WrapLength,
1790 WrapWidth(u8),
1791 FromTo,
1792 Undefined(u8),
1793}
1794#[cfg(feature = "alloc")]
1795use crate::SpecificationErrorImpl::*;
1796
1797#[derive(Debug, Copy, Clone)]
1799#[cfg(feature = "alloc")]
1800pub struct SpecificationError(SpecificationErrorImpl);
1801
1802#[cfg(feature = "alloc")]
1803impl core::fmt::Display for SpecificationError {
1804 fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
1805 match self.0 {
1806 BadSize => write!(f, "invalid number of symbols"),
1807 NotAscii => write!(f, "non-ascii character"),
1808 Duplicate(c) => write!(f, "{:?} has conflicting definitions", c as char),
1809 ExtraPadding => write!(f, "unnecessary padding"),
1810 WrapLength => write!(f, "invalid wrap width or separator length"),
1811 WrapWidth(x) => write!(f, "wrap width not a multiple of {}", x),
1812 FromTo => write!(f, "translate from/to length mismatch"),
1813 Undefined(c) => write!(f, "{:?} is undefined", c as char),
1814 }
1815 }
1816}
1817
1818#[cfg(feature = "std")]
1819impl std::error::Error for SpecificationError {
1820 fn description(&self) -> &str {
1821 match self.0 {
1822 BadSize => "invalid number of symbols",
1823 NotAscii => "non-ascii character",
1824 Duplicate(_) => "conflicting definitions",
1825 ExtraPadding => "unnecessary padding",
1826 WrapLength => "invalid wrap width or separator length",
1827 WrapWidth(_) => "wrap width not a multiple",
1828 FromTo => "translate from/to length mismatch",
1829 Undefined(_) => "undefined character",
1830 }
1831 }
1832}
1833
1834#[cfg(feature = "alloc")]
1835impl Specification {
1836 #[must_use]
1838 pub fn new() -> Specification {
1839 Specification {
1840 symbols: String::new(),
1841 bit_order: MostSignificantFirst,
1842 check_trailing_bits: true,
1843 padding: None,
1844 ignore: String::new(),
1845 wrap: Wrap { width: 0, separator: String::new() },
1846 translate: Translate { from: String::new(), to: String::new() },
1847 }
1848 }
1849
1850 pub fn encoding(&self) -> Result<Encoding, SpecificationError> {
1856 let symbols = self.symbols.as_bytes();
1857 let bit: u8 = match symbols.len() {
1858 2 => 1,
1859 4 => 2,
1860 8 => 3,
1861 16 => 4,
1862 32 => 5,
1863 64 => 6,
1864 _ => return Err(SpecificationError(BadSize)),
1865 };
1866 let mut values = [INVALID; 128];
1867 let set = |v: &mut [u8; 128], i: u8, x: u8| {
1868 check!(SpecificationError(NotAscii), i < 128);
1869 if v[i as usize] == x {
1870 return Ok(());
1871 }
1872 check!(SpecificationError(Duplicate(i)), v[i as usize] == INVALID);
1873 v[i as usize] = x;
1874 Ok(())
1875 };
1876 for (v, symbols) in symbols.iter().enumerate() {
1877 #[allow(clippy::cast_possible_truncation)] set(&mut values, *symbols, v as u8)?;
1879 }
1880 let msb = self.bit_order == MostSignificantFirst;
1881 let ctb = self.check_trailing_bits || 8 % bit == 0;
1882 let pad = match self.padding {
1883 None => None,
1884 Some(pad) => {
1885 check!(SpecificationError(ExtraPadding), 8 % bit != 0);
1886 check!(SpecificationError(NotAscii), pad.len_utf8() == 1);
1887 set(&mut values, pad as u8, PADDING)?;
1888 Some(pad as u8)
1889 }
1890 };
1891 for i in self.ignore.bytes() {
1892 set(&mut values, i, IGNORE)?;
1893 }
1894 let wrap = if self.wrap.separator.is_empty() || self.wrap.width == 0 {
1895 None
1896 } else {
1897 let col = self.wrap.width;
1898 let end = self.wrap.separator.as_bytes();
1899 check!(SpecificationError(WrapLength), col < 256 && end.len() < 256);
1900 #[allow(clippy::cast_possible_truncation)] let col = col as u8;
1902 #[allow(clippy::cast_possible_truncation)] let dec = dec(bit as usize) as u8;
1904 check!(SpecificationError(WrapWidth(dec)), col % dec == 0);
1905 for &i in end {
1906 set(&mut values, i, IGNORE)?;
1907 }
1908 Some((col, end))
1909 };
1910 let from = self.translate.from.as_bytes();
1911 let to = self.translate.to.as_bytes();
1912 check!(SpecificationError(FromTo), from.len() == to.len());
1913 for i in 0 .. from.len() {
1914 check!(SpecificationError(NotAscii), to[i] < 128);
1915 let v = values[to[i] as usize];
1916 check!(SpecificationError(Undefined(to[i])), v != INVALID);
1917 set(&mut values, from[i], v)?;
1918 }
1919 let mut encoding = Vec::new();
1920 for _ in 0 .. 256 / symbols.len() {
1921 encoding.extend_from_slice(symbols);
1922 }
1923 encoding.extend_from_slice(&values);
1924 encoding.extend_from_slice(&[INVALID; 128]);
1925 match pad {
1926 None => encoding.push(INVALID),
1927 Some(pad) => encoding.push(pad),
1928 }
1929 encoding.push(bit);
1930 if msb {
1931 encoding[513] |= 0x08;
1932 }
1933 if ctb {
1934 encoding[513] |= 0x10;
1935 }
1936 if let Some((col, end)) = wrap {
1937 encoding.push(col);
1938 encoding.extend_from_slice(end);
1939 } else if values.contains(&IGNORE) {
1940 encoding.push(0);
1941 }
1942 Ok(Encoding(Cow::Owned(encoding)))
1943 }
1944}
1945
1946pub const HEXLOWER: Encoding = Encoding::internal_new(HEXLOWER_IMPL);
1966const HEXLOWER_IMPL: &[u8] = &[
1967 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 97, 98, 99, 100, 101, 102, 48, 49, 50, 51, 52, 53, 54,
1968 55, 56, 57, 97, 98, 99, 100, 101, 102, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 97, 98, 99, 100,
1969 101, 102, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 97, 98, 99, 100, 101, 102, 48, 49, 50, 51,
1970 52, 53, 54, 55, 56, 57, 97, 98, 99, 100, 101, 102, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 97,
1971 98, 99, 100, 101, 102, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 97, 98, 99, 100, 101, 102, 48,
1972 49, 50, 51, 52, 53, 54, 55, 56, 57, 97, 98, 99, 100, 101, 102, 48, 49, 50, 51, 52, 53, 54, 55,
1973 56, 57, 97, 98, 99, 100, 101, 102, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 97, 98, 99, 100,
1974 101, 102, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 97, 98, 99, 100, 101, 102, 48, 49, 50, 51,
1975 52, 53, 54, 55, 56, 57, 97, 98, 99, 100, 101, 102, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 97,
1976 98, 99, 100, 101, 102, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 97, 98, 99, 100, 101, 102, 48,
1977 49, 50, 51, 52, 53, 54, 55, 56, 57, 97, 98, 99, 100, 101, 102, 48, 49, 50, 51, 52, 53, 54, 55,
1978 56, 57, 97, 98, 99, 100, 101, 102, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
1979 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
1980 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 0, 1, 2,
1981 3, 4, 5, 6, 7, 8, 9, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
1982 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
1983 128, 128, 128, 128, 128, 10, 11, 12, 13, 14, 15, 128, 128, 128, 128, 128, 128, 128, 128, 128,
1984 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
1985 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
1986 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
1987 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
1988 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
1989 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
1990 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
1991 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 28,
1992];
1993
1994pub const HEXLOWER_PERMISSIVE: Encoding = Encoding::internal_new(HEXLOWER_PERMISSIVE_IMPL);
2023const HEXLOWER_PERMISSIVE_IMPL: &[u8] = &[
2024 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 97, 98, 99, 100, 101, 102, 48, 49, 50, 51, 52, 53, 54,
2025 55, 56, 57, 97, 98, 99, 100, 101, 102, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 97, 98, 99, 100,
2026 101, 102, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 97, 98, 99, 100, 101, 102, 48, 49, 50, 51,
2027 52, 53, 54, 55, 56, 57, 97, 98, 99, 100, 101, 102, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 97,
2028 98, 99, 100, 101, 102, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 97, 98, 99, 100, 101, 102, 48,
2029 49, 50, 51, 52, 53, 54, 55, 56, 57, 97, 98, 99, 100, 101, 102, 48, 49, 50, 51, 52, 53, 54, 55,
2030 56, 57, 97, 98, 99, 100, 101, 102, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 97, 98, 99, 100,
2031 101, 102, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 97, 98, 99, 100, 101, 102, 48, 49, 50, 51,
2032 52, 53, 54, 55, 56, 57, 97, 98, 99, 100, 101, 102, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 97,
2033 98, 99, 100, 101, 102, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 97, 98, 99, 100, 101, 102, 48,
2034 49, 50, 51, 52, 53, 54, 55, 56, 57, 97, 98, 99, 100, 101, 102, 48, 49, 50, 51, 52, 53, 54, 55,
2035 56, 57, 97, 98, 99, 100, 101, 102, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
2036 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
2037 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 0, 1, 2,
2038 3, 4, 5, 6, 7, 8, 9, 128, 128, 128, 128, 128, 128, 128, 10, 11, 12, 13, 14, 15, 128, 128, 128,
2039 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
2040 128, 128, 128, 128, 10, 11, 12, 13, 14, 15, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
2041 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
2042 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
2043 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
2044 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
2045 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
2046 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
2047 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
2048 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 28,
2049];
2050
2051pub const HEXUPPER: Encoding = Encoding::internal_new(HEXUPPER_IMPL);
2075const HEXUPPER_IMPL: &[u8] = &[
2076 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 65, 66, 67, 68, 69, 70, 48, 49, 50, 51, 52, 53, 54, 55,
2077 56, 57, 65, 66, 67, 68, 69, 70, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 65, 66, 67, 68, 69, 70,
2078 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 65, 66, 67, 68, 69, 70, 48, 49, 50, 51, 52, 53, 54, 55,
2079 56, 57, 65, 66, 67, 68, 69, 70, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 65, 66, 67, 68, 69, 70,
2080 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 65, 66, 67, 68, 69, 70, 48, 49, 50, 51, 52, 53, 54, 55,
2081 56, 57, 65, 66, 67, 68, 69, 70, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 65, 66, 67, 68, 69, 70,
2082 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 65, 66, 67, 68, 69, 70, 48, 49, 50, 51, 52, 53, 54, 55,
2083 56, 57, 65, 66, 67, 68, 69, 70, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 65, 66, 67, 68, 69, 70,
2084 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 65, 66, 67, 68, 69, 70, 48, 49, 50, 51, 52, 53, 54, 55,
2085 56, 57, 65, 66, 67, 68, 69, 70, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 65, 66, 67, 68, 69, 70,
2086 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 65, 66, 67, 68, 69, 70, 128, 128, 128, 128, 128, 128,
2087 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
2088 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
2089 128, 128, 128, 128, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 128, 128, 128, 128, 128, 128, 128, 10, 11,
2090 12, 13, 14, 15, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
2091 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
2092 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
2093 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
2094 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
2095 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
2096 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
2097 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
2098 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
2099 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 28,
2100];
2101
2102pub const HEXUPPER_PERMISSIVE: Encoding = Encoding::internal_new(HEXUPPER_PERMISSIVE_IMPL);
2124const HEXUPPER_PERMISSIVE_IMPL: &[u8] = &[
2125 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 65, 66, 67, 68, 69, 70, 48, 49, 50, 51, 52, 53, 54, 55,
2126 56, 57, 65, 66, 67, 68, 69, 70, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 65, 66, 67, 68, 69, 70,
2127 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 65, 66, 67, 68, 69, 70, 48, 49, 50, 51, 52, 53, 54, 55,
2128 56, 57, 65, 66, 67, 68, 69, 70, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 65, 66, 67, 68, 69, 70,
2129 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 65, 66, 67, 68, 69, 70, 48, 49, 50, 51, 52, 53, 54, 55,
2130 56, 57, 65, 66, 67, 68, 69, 70, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 65, 66, 67, 68, 69, 70,
2131 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 65, 66, 67, 68, 69, 70, 48, 49, 50, 51, 52, 53, 54, 55,
2132 56, 57, 65, 66, 67, 68, 69, 70, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 65, 66, 67, 68, 69, 70,
2133 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 65, 66, 67, 68, 69, 70, 48, 49, 50, 51, 52, 53, 54, 55,
2134 56, 57, 65, 66, 67, 68, 69, 70, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 65, 66, 67, 68, 69, 70,
2135 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 65, 66, 67, 68, 69, 70, 128, 128, 128, 128, 128, 128,
2136 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
2137 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
2138 128, 128, 128, 128, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 128, 128, 128, 128, 128, 128, 128, 10, 11,
2139 12, 13, 14, 15, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
2140 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 10, 11, 12, 13, 14, 15, 128, 128, 128, 128,
2141 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
2142 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
2143 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
2144 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
2145 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
2146 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
2147 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
2148 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 28,
2149];
2150
2151pub const BASE32: Encoding = Encoding::internal_new(BASE32_IMPL);
2167const BASE32_IMPL: &[u8] = &[
2168 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88,
2169 89, 90, 50, 51, 52, 53, 54, 55, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80,
2170 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 50, 51, 52, 53, 54, 55, 65, 66, 67, 68, 69, 70, 71, 72,
2171 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 50, 51, 52, 53, 54, 55,
2172 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88,
2173 89, 90, 50, 51, 52, 53, 54, 55, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80,
2174 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 50, 51, 52, 53, 54, 55, 65, 66, 67, 68, 69, 70, 71, 72,
2175 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 50, 51, 52, 53, 54, 55,
2176 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88,
2177 89, 90, 50, 51, 52, 53, 54, 55, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80,
2178 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 50, 51, 52, 53, 54, 55, 128, 128, 128, 128, 128, 128,
2179 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
2180 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
2181 128, 128, 128, 128, 128, 128, 26, 27, 28, 29, 30, 31, 128, 128, 128, 128, 128, 130, 128, 128,
2182 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,
2183 25, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
2184 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
2185 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
2186 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
2187 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
2188 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
2189 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
2190 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
2191 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 61, 29,
2192];
2193
2194pub const BASE32_NOPAD: Encoding = Encoding::internal_new(BASE32_NOPAD_IMPL);
2205const BASE32_NOPAD_IMPL: &[u8] = &[
2206 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88,
2207 89, 90, 50, 51, 52, 53, 54, 55, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80,
2208 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 50, 51, 52, 53, 54, 55, 65, 66, 67, 68, 69, 70, 71, 72,
2209 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 50, 51, 52, 53, 54, 55,
2210 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88,
2211 89, 90, 50, 51, 52, 53, 54, 55, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80,
2212 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 50, 51, 52, 53, 54, 55, 65, 66, 67, 68, 69, 70, 71, 72,
2213 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 50, 51, 52, 53, 54, 55,
2214 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88,
2215 89, 90, 50, 51, 52, 53, 54, 55, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80,
2216 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 50, 51, 52, 53, 54, 55, 128, 128, 128, 128, 128, 128,
2217 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
2218 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
2219 128, 128, 128, 128, 128, 128, 26, 27, 28, 29, 30, 31, 128, 128, 128, 128, 128, 128, 128, 128,
2220 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,
2221 25, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
2222 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
2223 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
2224 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
2225 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
2226 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
2227 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
2228 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
2229 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 29,
2230];
2231
2232pub const BASE32_NOPAD_NOCASE: Encoding = Encoding::internal_new(BASE32_NOPAD_NOCASE_IMPL);
2245const BASE32_NOPAD_NOCASE_IMPL: &[u8] = &[
2246 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88,
2247 89, 90, 50, 51, 52, 53, 54, 55, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80,
2248 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 50, 51, 52, 53, 54, 55, 65, 66, 67, 68, 69, 70, 71, 72,
2249 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 50, 51, 52, 53, 54, 55,
2250 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88,
2251 89, 90, 50, 51, 52, 53, 54, 55, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80,
2252 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 50, 51, 52, 53, 54, 55, 65, 66, 67, 68, 69, 70, 71, 72,
2253 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 50, 51, 52, 53, 54, 55,
2254 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88,
2255 89, 90, 50, 51, 52, 53, 54, 55, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80,
2256 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 50, 51, 52, 53, 54, 55, 128, 128, 128, 128, 128, 128,
2257 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
2258 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
2259 128, 128, 128, 128, 128, 128, 26, 27, 28, 29, 30, 31, 128, 128, 128, 128, 128, 128, 128, 128,
2260 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,
2261 25, 128, 128, 128, 128, 128, 128, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17,
2262 18, 19, 20, 21, 22, 23, 24, 25, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
2263 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
2264 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
2265 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
2266 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
2267 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
2268 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
2269 128, 128, 128, 128, 128, 128, 128, 128, 29,
2270];
2271
2272pub const BASE32_NOPAD_VISUAL: Encoding = Encoding::internal_new(BASE32_NOPAD_VISUAL_IMPL);
2285const BASE32_NOPAD_VISUAL_IMPL: &[u8] = &[
2286 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88,
2287 89, 90, 50, 51, 52, 53, 54, 55, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80,
2288 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 50, 51, 52, 53, 54, 55, 65, 66, 67, 68, 69, 70, 71, 72,
2289 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 50, 51, 52, 53, 54, 55,
2290 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88,
2291 89, 90, 50, 51, 52, 53, 54, 55, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80,
2292 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 50, 51, 52, 53, 54, 55, 65, 66, 67, 68, 69, 70, 71, 72,
2293 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 50, 51, 52, 53, 54, 55,
2294 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88,
2295 89, 90, 50, 51, 52, 53, 54, 55, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80,
2296 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 50, 51, 52, 53, 54, 55, 128, 128, 128, 128, 128, 128,
2297 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
2298 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
2299 128, 128, 128, 128, 14, 8, 26, 27, 28, 29, 30, 31, 1, 128, 128, 128, 128, 128, 128, 128, 128,
2300 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,
2301 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 8, 128,
2302 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
2303 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
2304 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
2305 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
2306 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
2307 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
2308 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
2309 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 29,
2310];
2311
2312pub const BASE32HEX: Encoding = Encoding::internal_new(BASE32HEX_IMPL);
2328const BASE32HEX_IMPL: &[u8] = &[
2329 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78,
2330 79, 80, 81, 82, 83, 84, 85, 86, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 65, 66, 67, 68, 69, 70,
2331 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 48, 49, 50, 51, 52, 53, 54, 55,
2332 56, 57, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86,
2333 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78,
2334 79, 80, 81, 82, 83, 84, 85, 86, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 65, 66, 67, 68, 69, 70,
2335 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 48, 49, 50, 51, 52, 53, 54, 55,
2336 56, 57, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86,
2337 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78,
2338 79, 80, 81, 82, 83, 84, 85, 86, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 65, 66, 67, 68, 69, 70,
2339 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 128, 128, 128, 128, 128, 128,
2340 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
2341 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
2342 128, 128, 128, 128, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 128, 128, 128, 130, 128, 128, 128, 10, 11,
2343 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 128, 128, 128,
2344 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
2345 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
2346 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
2347 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
2348 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
2349 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
2350 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
2351 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
2352 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 61, 29,
2353];
2354
2355pub const BASE32HEX_NOPAD: Encoding = Encoding::internal_new(BASE32HEX_NOPAD_IMPL);
2366const BASE32HEX_NOPAD_IMPL: &[u8] = &[
2367 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78,
2368 79, 80, 81, 82, 83, 84, 85, 86, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 65, 66, 67, 68, 69, 70,
2369 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 48, 49, 50, 51, 52, 53, 54, 55,
2370 56, 57, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86,
2371 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78,
2372 79, 80, 81, 82, 83, 84, 85, 86, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 65, 66, 67, 68, 69, 70,
2373 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 48, 49, 50, 51, 52, 53, 54, 55,
2374 56, 57, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86,
2375 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78,
2376 79, 80, 81, 82, 83, 84, 85, 86, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 65, 66, 67, 68, 69, 70,
2377 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 128, 128, 128, 128, 128, 128,
2378 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
2379 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
2380 128, 128, 128, 128, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 128, 128, 128, 128, 128, 128, 128, 10, 11,
2381 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 128, 128, 128,
2382 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
2383 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
2384 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
2385 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
2386 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
2387 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
2388 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
2389 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
2390 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 29,
2391];
2392
2393pub const BASE32_DNSSEC: Encoding = Encoding::internal_new(BASE32_DNSSEC_IMPL);
2414const BASE32_DNSSEC_IMPL: &[u8] = &[
2415 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107,
2416 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57,
2417 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115,
2418 116, 117, 118, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 97, 98, 99, 100, 101, 102, 103, 104,
2419 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 48, 49, 50, 51, 52, 53,
2420 54, 55, 56, 57, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112,
2421 113, 114, 115, 116, 117, 118, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 97, 98, 99, 100, 101,
2422 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 48, 49,
2423 50, 51, 52, 53, 54, 55, 56, 57, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109,
2424 110, 111, 112, 113, 114, 115, 116, 117, 118, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 97, 98,
2425 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117,
2426 118, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106,
2427 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 128, 128, 128, 128, 128, 128, 128,
2428 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
2429 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
2430 128, 128, 128, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 128, 128, 128, 128, 128, 128, 128, 10, 11, 12, 13,
2431 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 128, 128, 128, 128,
2432 128, 128, 128, 128, 128, 128, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25,
2433 26, 27, 28, 29, 30, 31, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
2434 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
2435 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
2436 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
2437 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
2438 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
2439 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
2440 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 29,
2441];
2442
2443#[allow(clippy::doc_markdown)]
2444pub const BASE32_DNSCURVE: Encoding = Encoding::internal_new(BASE32_DNSCURVE_IMPL);
2462const BASE32_DNSCURVE_IMPL: &[u8] = &[
2463 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 98, 99, 100, 102, 103, 104, 106, 107, 108, 109, 110,
2464 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57,
2465 98, 99, 100, 102, 103, 104, 106, 107, 108, 109, 110, 112, 113, 114, 115, 116, 117, 118, 119,
2466 120, 121, 122, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 98, 99, 100, 102, 103, 104, 106, 107,
2467 108, 109, 110, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 48, 49, 50, 51, 52, 53,
2468 54, 55, 56, 57, 98, 99, 100, 102, 103, 104, 106, 107, 108, 109, 110, 112, 113, 114, 115, 116,
2469 117, 118, 119, 120, 121, 122, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 98, 99, 100, 102, 103,
2470 104, 106, 107, 108, 109, 110, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 48, 49,
2471 50, 51, 52, 53, 54, 55, 56, 57, 98, 99, 100, 102, 103, 104, 106, 107, 108, 109, 110, 112, 113,
2472 114, 115, 116, 117, 118, 119, 120, 121, 122, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 98, 99,
2473 100, 102, 103, 104, 106, 107, 108, 109, 110, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121,
2474 122, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 98, 99, 100, 102, 103, 104, 106, 107, 108, 109,
2475 110, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 128, 128, 128, 128, 128, 128, 128,
2476 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
2477 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
2478 128, 128, 128, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 128, 128, 128, 128, 128, 128, 128, 128, 10, 11,
2479 12, 128, 13, 14, 15, 128, 16, 17, 18, 19, 20, 128, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31,
2480 128, 128, 128, 128, 128, 128, 128, 10, 11, 12, 128, 13, 14, 15, 128, 16, 17, 18, 19, 20, 128,
2481 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
2482 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
2483 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
2484 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
2485 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
2486 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
2487 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
2488 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 21,
2489];
2490
2491pub const BASE64: Encoding = Encoding::internal_new(BASE64_IMPL);
2507const BASE64_IMPL: &[u8] = &[
2508 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88,
2509 89, 90, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114,
2510 115, 116, 117, 118, 119, 120, 121, 122, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 43, 47, 65, 66,
2511 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90,
2512 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115,
2513 116, 117, 118, 119, 120, 121, 122, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 43, 47, 65, 66, 67,
2514 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 97,
2515 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116,
2516 117, 118, 119, 120, 121, 122, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 43, 47, 65, 66, 67, 68,
2517 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 97, 98,
2518 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117,
2519 118, 119, 120, 121, 122, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 43, 47, 128, 128, 128, 128,
2520 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
2521 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
2522 128, 62, 128, 128, 128, 63, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 128, 128, 128, 130, 128,
2523 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,
2524 24, 25, 128, 128, 128, 128, 128, 128, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39,
2525 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 128, 128, 128, 128, 128, 128, 128, 128, 128,
2526 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
2527 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
2528 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
2529 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
2530 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
2531 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
2532 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 61, 30,
2533];
2534
2535pub const BASE64_NOPAD: Encoding = Encoding::internal_new(BASE64_NOPAD_IMPL);
2546const BASE64_NOPAD_IMPL: &[u8] = &[
2547 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88,
2548 89, 90, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114,
2549 115, 116, 117, 118, 119, 120, 121, 122, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 43, 47, 65, 66,
2550 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90,
2551 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115,
2552 116, 117, 118, 119, 120, 121, 122, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 43, 47, 65, 66, 67,
2553 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 97,
2554 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116,
2555 117, 118, 119, 120, 121, 122, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 43, 47, 65, 66, 67, 68,
2556 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 97, 98,
2557 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117,
2558 118, 119, 120, 121, 122, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 43, 47, 128, 128, 128, 128,
2559 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
2560 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
2561 128, 62, 128, 128, 128, 63, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 128, 128, 128, 128, 128,
2562 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,
2563 24, 25, 128, 128, 128, 128, 128, 128, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39,
2564 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 128, 128, 128, 128, 128, 128, 128, 128, 128,
2565 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
2566 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
2567 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
2568 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
2569 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
2570 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
2571 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 30,
2572];
2573
2574pub const BASE64_MIME: Encoding = Encoding::internal_new(BASE64_MIME_IMPL);
2593const BASE64_MIME_IMPL: &[u8] = &[
2594 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88,
2595 89, 90, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114,
2596 115, 116, 117, 118, 119, 120, 121, 122, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 43, 47, 65, 66,
2597 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90,
2598 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115,
2599 116, 117, 118, 119, 120, 121, 122, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 43, 47, 65, 66, 67,
2600 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 97,
2601 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116,
2602 117, 118, 119, 120, 121, 122, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 43, 47, 65, 66, 67, 68,
2603 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 97, 98,
2604 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117,
2605 118, 119, 120, 121, 122, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 43, 47, 128, 128, 128, 128,
2606 128, 128, 128, 128, 128, 128, 129, 128, 128, 129, 128, 128, 128, 128, 128, 128, 128, 128, 128,
2607 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
2608 128, 62, 128, 128, 128, 63, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 128, 128, 128, 130, 128,
2609 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,
2610 24, 25, 128, 128, 128, 128, 128, 128, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39,
2611 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 128, 128, 128, 128, 128, 128, 128, 128, 128,
2612 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
2613 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
2614 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
2615 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
2616 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
2617 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
2618 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 61, 30, 76, 13, 10,
2619];
2620
2621pub const BASE64_MIME_PERMISSIVE: Encoding = Encoding::internal_new(BASE64_MIME_PERMISSIVE_IMPL);
2641const BASE64_MIME_PERMISSIVE_IMPL: &[u8] = &[
2642 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88,
2643 89, 90, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114,
2644 115, 116, 117, 118, 119, 120, 121, 122, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 43, 47, 65, 66,
2645 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90,
2646 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115,
2647 116, 117, 118, 119, 120, 121, 122, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 43, 47, 65, 66, 67,
2648 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 97,
2649 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116,
2650 117, 118, 119, 120, 121, 122, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 43, 47, 65, 66, 67, 68,
2651 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 97, 98,
2652 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117,
2653 118, 119, 120, 121, 122, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 43, 47, 128, 128, 128, 128,
2654 128, 128, 128, 128, 128, 128, 129, 128, 128, 129, 128, 128, 128, 128, 128, 128, 128, 128, 128,
2655 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
2656 128, 62, 128, 128, 128, 63, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 128, 128, 128, 130, 128,
2657 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,
2658 24, 25, 128, 128, 128, 128, 128, 128, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39,
2659 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 128, 128, 128, 128, 128, 128, 128, 128, 128,
2660 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
2661 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
2662 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
2663 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
2664 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
2665 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
2666 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 61, 14, 76, 13, 10,
2667];
2668
2669pub const BASE64URL: Encoding = Encoding::internal_new(BASE64URL_IMPL);
2685const BASE64URL_IMPL: &[u8] = &[
2686 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88,
2687 89, 90, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114,
2688 115, 116, 117, 118, 119, 120, 121, 122, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 45, 95, 65, 66,
2689 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90,
2690 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115,
2691 116, 117, 118, 119, 120, 121, 122, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 45, 95, 65, 66, 67,
2692 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 97,
2693 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116,
2694 117, 118, 119, 120, 121, 122, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 45, 95, 65, 66, 67, 68,
2695 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 97, 98,
2696 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117,
2697 118, 119, 120, 121, 122, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 45, 95, 128, 128, 128, 128,
2698 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
2699 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
2700 128, 128, 128, 62, 128, 128, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 128, 128, 128, 130, 128,
2701 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,
2702 24, 25, 128, 128, 128, 128, 63, 128, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39,
2703 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 128, 128, 128, 128, 128, 128, 128, 128, 128,
2704 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
2705 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
2706 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
2707 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
2708 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
2709 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
2710 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 61, 30,
2711];
2712
2713pub const BASE64URL_NOPAD: Encoding = Encoding::internal_new(BASE64URL_NOPAD_IMPL);
2724const BASE64URL_NOPAD_IMPL: &[u8] = &[
2725 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88,
2726 89, 90, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114,
2727 115, 116, 117, 118, 119, 120, 121, 122, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 45, 95, 65, 66,
2728 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90,
2729 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115,
2730 116, 117, 118, 119, 120, 121, 122, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 45, 95, 65, 66, 67,
2731 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 97,
2732 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116,
2733 117, 118, 119, 120, 121, 122, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 45, 95, 65, 66, 67, 68,
2734 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 97, 98,
2735 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117,
2736 118, 119, 120, 121, 122, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 45, 95, 128, 128, 128, 128,
2737 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
2738 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
2739 128, 128, 128, 62, 128, 128, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 128, 128, 128, 128, 128,
2740 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,
2741 24, 25, 128, 128, 128, 128, 63, 128, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39,
2742 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 128, 128, 128, 128, 128, 128, 128, 128, 128,
2743 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
2744 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
2745 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
2746 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
2747 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
2748 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
2749 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 30,
2750];