1#![no_std]
147#![cfg_attr(docsrs, feature(doc_auto_cfg))]
148#![warn(elided_lifetimes_in_paths)]
150#![warn(missing_debug_implementations)]
152#![warn(missing_docs)]
153#![warn(unreachable_pub)]
154#![warn(unused_results)]
156#![allow(unused_unsafe)] #![warn(clippy::pedantic)]
158#![allow(clippy::assigning_clones)] #![allow(clippy::doc_markdown)]
160#![allow(clippy::enum_glob_use)]
161#![allow(clippy::similar_names)]
162#![allow(clippy::uninlined_format_args)] #[cfg(feature = "alloc")]
165extern crate alloc;
166#[cfg(feature = "std")]
167extern crate std;
168
169#[cfg(feature = "alloc")]
170use alloc::borrow::{Cow, ToOwned};
171#[cfg(feature = "alloc")]
172use alloc::string::String;
173#[cfg(feature = "alloc")]
174use alloc::vec;
175#[cfg(feature = "alloc")]
176use alloc::vec::Vec;
177use core::convert::TryInto;
178
179macro_rules! check {
180 ($e: expr, $c: expr) => {
181 if !$c {
182 return Err($e);
183 }
184 };
185}
186
187trait Static<T: Copy>: Copy {
188 fn val(self) -> T;
189}
190
191macro_rules! define {
192 ($name: ident: $type: ty = $val: expr) => {
193 #[derive(Copy, Clone)]
194 struct $name;
195 impl Static<$type> for $name {
196 fn val(self) -> $type {
197 $val
198 }
199 }
200 };
201}
202
203define!(Bf: bool = false);
204define!(Bt: bool = true);
205define!(N1: usize = 1);
206define!(N2: usize = 2);
207define!(N3: usize = 3);
208define!(N4: usize = 4);
209define!(N5: usize = 5);
210define!(N6: usize = 6);
211
212#[derive(Copy, Clone)]
213struct On;
214
215impl<T: Copy> Static<Option<T>> for On {
216 fn val(self) -> Option<T> {
217 None
218 }
219}
220
221#[derive(Copy, Clone)]
222struct Os<T>(T);
223
224impl<T: Copy> Static<Option<T>> for Os<T> {
225 fn val(self) -> Option<T> {
226 Some(self.0)
227 }
228}
229
230macro_rules! dispatch {
231 (let $var: ident: bool = $val: expr; $($body: tt)*) => {
232 if $val {
233 let $var = Bt; dispatch!($($body)*)
234 } else {
235 let $var = Bf; dispatch!($($body)*)
236 }
237 };
238 (let $var: ident: usize = $val: expr; $($body: tt)*) => {
239 match $val {
240 1 => { let $var = N1; dispatch!($($body)*) },
241 2 => { let $var = N2; dispatch!($($body)*) },
242 3 => { let $var = N3; dispatch!($($body)*) },
243 4 => { let $var = N4; dispatch!($($body)*) },
244 5 => { let $var = N5; dispatch!($($body)*) },
245 6 => { let $var = N6; dispatch!($($body)*) },
246 _ => panic!(),
247 }
248 };
249 (let $var: ident: Option<$type: ty> = $val: expr; $($body: tt)*) => {
250 match $val {
251 None => { let $var = On; dispatch!($($body)*) },
252 Some(x) => { let $var = Os(x); dispatch!($($body)*) },
253 }
254 };
255 ($body: expr) => { $body };
256}
257
258unsafe fn chunk_unchecked(x: &[u8], n: usize, i: usize) -> &[u8] {
259 debug_assert!((i + 1) * n <= x.len());
260 unsafe { core::slice::from_raw_parts(x.as_ptr().add(n * i), n) }
261}
262
263unsafe fn chunk_mut_unchecked(x: &mut [u8], n: usize, i: usize) -> &mut [u8] {
264 debug_assert!((i + 1) * n <= x.len());
265 unsafe { core::slice::from_raw_parts_mut(x.as_mut_ptr().add(n * i), n) }
266}
267
268fn div_ceil(x: usize, m: usize) -> usize {
269 (x + m - 1) / m
270}
271
272fn floor(x: usize, m: usize) -> usize {
273 x / m * m
274}
275
276fn vectorize<F: FnMut(usize)>(n: usize, bs: usize, mut f: F) {
277 for k in 0 .. n / bs {
278 for i in k * bs .. (k + 1) * bs {
279 f(i);
280 }
281 }
282 for i in floor(n, bs) .. n {
283 f(i);
284 }
285}
286
287#[derive(Debug, Copy, Clone, PartialEq, Eq)]
289pub enum DecodeKind {
290 Length,
292
293 Symbol,
295
296 Trailing,
298
299 Padding,
301}
302
303impl core::fmt::Display for DecodeKind {
304 fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
305 let description = match self {
306 DecodeKind::Length => "invalid length",
307 DecodeKind::Symbol => "invalid symbol",
308 DecodeKind::Trailing => "non-zero trailing bits",
309 DecodeKind::Padding => "invalid padding length",
310 };
311 write!(f, "{}", description)
312 }
313}
314
315#[derive(Debug, Copy, Clone, PartialEq, Eq)]
317pub struct DecodeError {
318 pub position: usize,
322
323 pub kind: DecodeKind,
325}
326
327#[cfg(feature = "std")]
328impl std::error::Error for DecodeError {}
329
330impl core::fmt::Display for DecodeError {
331 fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
332 write!(f, "{} at {}", self.kind, self.position)
333 }
334}
335
336#[derive(Debug, Copy, Clone, PartialEq, Eq)]
338pub struct DecodePartial {
339 pub read: usize,
343
344 pub written: usize,
348
349 pub error: DecodeError,
351}
352
353const INVALID: u8 = 128;
354const IGNORE: u8 = 129;
355const PADDING: u8 = 130;
356
357fn order(msb: bool, n: usize, i: usize) -> usize {
358 if msb {
359 n - 1 - i
360 } else {
361 i
362 }
363}
364
365fn enc(bit: usize) -> usize {
366 match bit {
367 1 | 2 | 4 => 1,
368 3 | 6 => 3,
369 5 => 5,
370 _ => unreachable!(),
371 }
372}
373
374fn dec(bit: usize) -> usize {
375 enc(bit) * 8 / bit
376}
377
378fn encode_len<B: Static<usize>>(bit: B, len: usize) -> usize {
379 div_ceil(8 * len, bit.val())
380}
381
382fn encode_block<B: Static<usize>, M: Static<bool>>(
383 bit: B, msb: M, symbols: &[u8; 256], input: &[u8], output: &mut [u8],
384) {
385 debug_assert!(input.len() <= enc(bit.val()));
386 debug_assert_eq!(output.len(), encode_len(bit, input.len()));
387 let bit = bit.val();
388 let msb = msb.val();
389 let mut x = 0u64;
390 for (i, input) in input.iter().enumerate() {
391 x |= u64::from(*input) << (8 * order(msb, enc(bit), i));
392 }
393 for (i, output) in output.iter_mut().enumerate() {
394 let y = x >> (bit * order(msb, dec(bit), i));
395 *output = symbols[(y & 0xff) as usize];
396 }
397}
398
399fn encode_mut<B: Static<usize>, M: Static<bool>>(
400 bit: B, msb: M, symbols: &[u8; 256], input: &[u8], output: &mut [u8],
401) {
402 debug_assert_eq!(output.len(), encode_len(bit, input.len()));
403 let enc = enc(bit.val());
404 let dec = dec(bit.val());
405 let n = input.len() / enc;
406 let bs = match bit.val() {
407 5 => 2,
408 6 => 4,
409 _ => 1,
410 };
411 vectorize(n, bs, |i| {
412 let input = unsafe { chunk_unchecked(input, enc, i) };
413 let output = unsafe { chunk_mut_unchecked(output, dec, i) };
414 encode_block(bit, msb, symbols, input, output);
415 });
416 encode_block(bit, msb, symbols, &input[enc * n ..], &mut output[dec * n ..]);
417}
418
419fn decode_block<B: Static<usize>, M: Static<bool>>(
422 bit: B, msb: M, values: &[u8; 256], input: &[u8], output: &mut [u8],
423) -> Result<(), usize> {
424 debug_assert!(output.len() <= enc(bit.val()));
425 debug_assert_eq!(input.len(), encode_len(bit, output.len()));
426 let bit = bit.val();
427 let msb = msb.val();
428 let mut x = 0u64;
429 for j in 0 .. input.len() {
430 let y = values[input[j] as usize];
431 check!(j, y < 1 << bit);
432 x |= u64::from(y) << (bit * order(msb, dec(bit), j));
433 }
434 for (j, output) in output.iter_mut().enumerate() {
435 *output = (x >> (8 * order(msb, enc(bit), j)) & 0xff) as u8;
436 }
437 Ok(())
438}
439
440fn decode_mut<B: Static<usize>, M: Static<bool>>(
444 bit: B, msb: M, values: &[u8; 256], input: &[u8], output: &mut [u8],
445) -> Result<(), usize> {
446 debug_assert_eq!(input.len(), encode_len(bit, output.len()));
447 let enc = enc(bit.val());
448 let dec = dec(bit.val());
449 let n = input.len() / dec;
450 for i in 0 .. n {
451 let input = unsafe { chunk_unchecked(input, dec, i) };
452 let output = unsafe { chunk_mut_unchecked(output, enc, i) };
453 decode_block(bit, msb, values, input, output).map_err(|e| dec * i + e)?;
454 }
455 decode_block(bit, msb, values, &input[dec * n ..], &mut output[enc * n ..])
456 .map_err(|e| dec * n + e)
457}
458
459fn check_trail<B: Static<usize>, M: Static<bool>>(
461 bit: B, msb: M, ctb: bool, values: &[u8; 256], input: &[u8],
462) -> Result<(), ()> {
463 if 8 % bit.val() == 0 || !ctb {
464 return Ok(());
465 }
466 let trail = bit.val() * input.len() % 8;
467 if trail == 0 {
468 return Ok(());
469 }
470 let mut mask = (1 << trail) - 1;
471 if !msb.val() {
472 mask <<= bit.val() - trail;
473 }
474 check!((), values[input[input.len() - 1] as usize] & mask == 0);
475 Ok(())
476}
477
478fn check_pad<B: Static<usize>>(bit: B, values: &[u8; 256], input: &[u8]) -> Result<usize, usize> {
481 let bit = bit.val();
482 debug_assert_eq!(input.len(), dec(bit));
483 let is_pad = |x: &&u8| values[**x as usize] == PADDING;
484 let count = input.iter().rev().take_while(is_pad).count();
485 let len = input.len() - count;
486 check!(len, len > 0 && bit * len % 8 < bit);
487 Ok(len)
488}
489
490fn encode_base_len<B: Static<usize>>(bit: B, len: usize) -> usize {
491 encode_len(bit, len)
492}
493
494fn encode_base<B: Static<usize>, M: Static<bool>>(
495 bit: B, msb: M, symbols: &[u8; 256], input: &[u8], output: &mut [u8],
496) {
497 debug_assert_eq!(output.len(), encode_base_len(bit, input.len()));
498 encode_mut(bit, msb, symbols, input, output);
499}
500
501fn encode_pad_len<B: Static<usize>, P: Static<Option<u8>>>(bit: B, pad: P, len: usize) -> usize {
502 match pad.val() {
503 None => encode_base_len(bit, len),
504 Some(_) => div_ceil(len, enc(bit.val())) * dec(bit.val()),
505 }
506}
507
508fn encode_pad<B: Static<usize>, M: Static<bool>, P: Static<Option<u8>>>(
509 bit: B, msb: M, symbols: &[u8; 256], spad: P, input: &[u8], output: &mut [u8],
510) {
511 let pad = match spad.val() {
512 None => return encode_base(bit, msb, symbols, input, output),
513 Some(pad) => pad,
514 };
515 debug_assert_eq!(output.len(), encode_pad_len(bit, spad, input.len()));
516 let olen = encode_base_len(bit, input.len());
517 encode_base(bit, msb, symbols, input, &mut output[.. olen]);
518 for output in output.iter_mut().skip(olen) {
519 *output = pad;
520 }
521}
522
523fn encode_wrap_len<
524 'a,
525 B: Static<usize>,
526 P: Static<Option<u8>>,
527 W: Static<Option<(usize, &'a [u8])>>,
528>(
529 bit: B, pad: P, wrap: W, ilen: usize,
530) -> usize {
531 let olen = encode_pad_len(bit, pad, ilen);
532 match wrap.val() {
533 None => olen,
534 Some((col, end)) => olen + end.len() * div_ceil(olen, col),
535 }
536}
537
538fn encode_wrap_mut<
539 'a,
540 B: Static<usize>,
541 M: Static<bool>,
542 P: Static<Option<u8>>,
543 W: Static<Option<(usize, &'a [u8])>>,
544>(
545 bit: B, msb: M, symbols: &[u8; 256], pad: P, wrap: W, input: &[u8], output: &mut [u8],
546) {
547 let (col, end) = match wrap.val() {
548 None => return encode_pad(bit, msb, symbols, pad, input, output),
549 Some((col, end)) => (col, end),
550 };
551 debug_assert_eq!(output.len(), encode_wrap_len(bit, pad, wrap, input.len()));
552 debug_assert_eq!(col % dec(bit.val()), 0);
553 let col = col / dec(bit.val());
554 let enc = col * enc(bit.val());
555 let dec = col * dec(bit.val()) + end.len();
556 let olen = dec - end.len();
557 let n = input.len() / enc;
558 for i in 0 .. n {
559 let input = unsafe { chunk_unchecked(input, enc, i) };
560 let output = unsafe { chunk_mut_unchecked(output, dec, i) };
561 encode_base(bit, msb, symbols, input, &mut output[.. olen]);
562 output[olen ..].copy_from_slice(end);
563 }
564 if input.len() > enc * n {
565 let olen = dec * n + encode_pad_len(bit, pad, input.len() - enc * n);
566 encode_pad(bit, msb, symbols, pad, &input[enc * n ..], &mut output[dec * n .. olen]);
567 output[olen ..].copy_from_slice(end);
568 }
569}
570
571fn decode_wrap_len<B: Static<usize>, P: Static<bool>>(
573 bit: B, pad: P, len: usize,
574) -> (usize, usize) {
575 let bit = bit.val();
576 if pad.val() {
577 (floor(len, dec(bit)), len / dec(bit) * enc(bit))
578 } else {
579 let trail = bit * len % 8;
580 (len - trail / bit, bit * len / 8)
581 }
582}
583
584fn decode_pad_len<B: Static<usize>, P: Static<bool>>(
587 bit: B, pad: P, len: usize,
588) -> Result<usize, DecodeError> {
589 let (ilen, olen) = decode_wrap_len(bit, pad, len);
590 check!(DecodeError { position: ilen, kind: DecodeKind::Length }, ilen == len);
591 Ok(olen)
592}
593
594fn decode_base_len<B: Static<usize>>(bit: B, len: usize) -> Result<usize, DecodeError> {
597 decode_pad_len(bit, Bf, len)
598}
599
600fn decode_base_mut<B: Static<usize>, M: Static<bool>>(
604 bit: B, msb: M, ctb: bool, values: &[u8; 256], input: &[u8], output: &mut [u8],
605) -> Result<usize, DecodePartial> {
606 debug_assert_eq!(Ok(output.len()), decode_base_len(bit, input.len()));
607 let fail = |pos, kind| DecodePartial {
608 read: pos / dec(bit.val()) * dec(bit.val()),
609 written: pos / dec(bit.val()) * enc(bit.val()),
610 error: DecodeError { position: pos, kind },
611 };
612 decode_mut(bit, msb, values, input, output).map_err(|pos| fail(pos, DecodeKind::Symbol))?;
613 check_trail(bit, msb, ctb, values, input)
614 .map_err(|()| fail(input.len() - 1, DecodeKind::Trailing))?;
615 Ok(output.len())
616}
617
618fn decode_pad_mut<B: Static<usize>, M: Static<bool>, P: Static<bool>>(
624 bit: B, msb: M, ctb: bool, values: &[u8; 256], pad: P, input: &[u8], output: &mut [u8],
625) -> Result<usize, DecodePartial> {
626 if !pad.val() {
627 return decode_base_mut(bit, msb, ctb, values, input, output);
628 }
629 debug_assert_eq!(Ok(output.len()), decode_pad_len(bit, pad, input.len()));
630 let enc = enc(bit.val());
631 let dec = dec(bit.val());
632 let mut inpos = 0;
633 let mut outpos = 0;
634 let mut outend = output.len();
635 while inpos < input.len() {
636 match decode_base_mut(
637 bit,
638 msb,
639 ctb,
640 values,
641 &input[inpos ..],
642 &mut output[outpos .. outend],
643 ) {
644 Ok(written) => {
645 if cfg!(debug_assertions) {
646 inpos = input.len();
647 }
648 outpos += written;
649 break;
650 }
651 Err(partial) => {
652 inpos += partial.read;
653 outpos += partial.written;
654 }
655 }
656 let inlen =
657 check_pad(bit, values, &input[inpos .. inpos + dec]).map_err(|pos| DecodePartial {
658 read: inpos,
659 written: outpos,
660 error: DecodeError { position: inpos + pos, kind: DecodeKind::Padding },
661 })?;
662 let outlen = decode_base_len(bit, inlen).unwrap();
663 let written = decode_base_mut(
664 bit,
665 msb,
666 ctb,
667 values,
668 &input[inpos .. inpos + inlen],
669 &mut output[outpos .. outpos + outlen],
670 )
671 .map_err(|partial| {
672 debug_assert_eq!(partial.read, 0);
673 debug_assert_eq!(partial.written, 0);
674 DecodePartial {
675 read: inpos,
676 written: outpos,
677 error: DecodeError {
678 position: inpos + partial.error.position,
679 kind: partial.error.kind,
680 },
681 }
682 })?;
683 debug_assert_eq!(written, outlen);
684 inpos += dec;
685 outpos += outlen;
686 outend -= enc - outlen;
687 }
688 debug_assert_eq!(inpos, input.len());
689 debug_assert_eq!(outpos, outend);
690 Ok(outend)
691}
692
693fn skip_ignore(values: &[u8; 256], input: &[u8], mut inpos: usize) -> usize {
694 while inpos < input.len() && values[input[inpos] as usize] == IGNORE {
695 inpos += 1;
696 }
697 inpos
698}
699
700fn decode_wrap_block<B: Static<usize>, M: Static<bool>, P: Static<bool>>(
707 bit: B, msb: M, ctb: bool, values: &[u8; 256], pad: P, input: &[u8], output: &mut [u8],
708) -> Result<(usize, usize), DecodeError> {
709 let dec = dec(bit.val());
710 let mut buf = [0u8; 8];
711 let mut shift = [0usize; 8];
712 let mut bufpos = 0;
713 let mut inpos = 0;
714 while bufpos < dec {
715 inpos = skip_ignore(values, input, inpos);
716 if inpos == input.len() {
717 break;
718 }
719 shift[bufpos] = inpos;
720 buf[bufpos] = input[inpos];
721 bufpos += 1;
722 inpos += 1;
723 }
724 let olen = decode_pad_len(bit, pad, bufpos).map_err(|mut e| {
725 e.position = shift[e.position];
726 e
727 })?;
728 let written = decode_pad_mut(bit, msb, ctb, values, pad, &buf[.. bufpos], &mut output[.. olen])
729 .map_err(|partial| {
730 debug_assert_eq!(partial.read, 0);
731 debug_assert_eq!(partial.written, 0);
732 DecodeError { position: shift[partial.error.position], kind: partial.error.kind }
733 })?;
734 Ok((inpos, written))
735}
736
737#[allow(clippy::too_many_arguments)]
744fn decode_wrap_mut<B: Static<usize>, M: Static<bool>, P: Static<bool>, I: Static<bool>>(
745 bit: B, msb: M, ctb: bool, values: &[u8; 256], pad: P, has_ignore: I, input: &[u8],
746 output: &mut [u8],
747) -> Result<usize, DecodePartial> {
748 if !has_ignore.val() {
749 return decode_pad_mut(bit, msb, ctb, values, pad, input, output);
750 }
751 debug_assert_eq!(output.len(), decode_wrap_len(bit, pad, input.len()).1);
752 let mut inpos = 0;
753 let mut outpos = 0;
754 while inpos < input.len() {
755 let (inlen, outlen) = decode_wrap_len(bit, pad, input.len() - inpos);
756 match decode_pad_mut(
757 bit,
758 msb,
759 ctb,
760 values,
761 pad,
762 &input[inpos .. inpos + inlen],
763 &mut output[outpos .. outpos + outlen],
764 ) {
765 Ok(written) => {
766 inpos += inlen;
767 outpos += written;
768 break;
769 }
770 Err(partial) => {
771 inpos += partial.read;
772 outpos += partial.written;
773 }
774 }
775 let (ipos, opos) =
776 decode_wrap_block(bit, msb, ctb, values, pad, &input[inpos ..], &mut output[outpos ..])
777 .map_err(|mut error| {
778 error.position += inpos;
779 DecodePartial { read: inpos, written: outpos, error }
780 })?;
781 inpos += ipos;
782 outpos += opos;
783 }
784 let inpos = skip_ignore(values, input, inpos);
785 if inpos == input.len() {
786 Ok(outpos)
787 } else {
788 Err(DecodePartial {
789 read: inpos,
790 written: outpos,
791 error: DecodeError { position: inpos, kind: DecodeKind::Length },
792 })
793 }
794}
795
796#[derive(Debug, Copy, Clone, PartialEq, Eq)]
822#[cfg(feature = "alloc")]
823pub enum BitOrder {
824 MostSignificantFirst,
833
834 LeastSignificantFirst,
848}
849#[cfg(feature = "alloc")]
850use crate::BitOrder::*;
851
852#[doc(hidden)]
853#[cfg(feature = "alloc")]
854pub type InternalEncoding = Cow<'static, [u8]>;
855
856#[doc(hidden)]
857#[cfg(not(feature = "alloc"))]
858pub type InternalEncoding = &'static [u8];
859
860#[derive(Debug, Clone, PartialEq, Eq)]
883pub struct Encoding(#[doc(hidden)] pub InternalEncoding);
884
885#[derive(Debug, Clone)]
892#[cfg(feature = "alloc")]
893pub struct Translate {
894 pub from: String,
896
897 pub to: String,
899}
900
901#[derive(Debug, Clone)]
905#[cfg(feature = "alloc")]
906pub struct Wrap {
907 pub width: usize,
917
918 pub separator: String,
922}
923
924#[derive(Debug, Clone)]
1161#[cfg(feature = "alloc")]
1162pub struct Specification {
1163 pub symbols: String,
1168
1169 pub bit_order: BitOrder,
1173
1174 pub check_trailing_bits: bool,
1179
1180 pub padding: Option<char>,
1185
1186 pub ignore: String,
1191
1192 pub wrap: Wrap,
1197
1198 pub translate: Translate,
1205}
1206
1207#[cfg(feature = "alloc")]
1208impl Default for Specification {
1209 fn default() -> Self {
1210 Self::new()
1211 }
1212}
1213
1214impl Encoding {
1215 fn sym(&self) -> &[u8; 256] {
1216 self.0[0 .. 256].try_into().unwrap()
1217 }
1218
1219 fn val(&self) -> &[u8; 256] {
1220 self.0[256 .. 512].try_into().unwrap()
1221 }
1222
1223 fn pad(&self) -> Option<u8> {
1224 if self.0[512] < 128 {
1225 Some(self.0[512])
1226 } else {
1227 None
1228 }
1229 }
1230
1231 fn ctb(&self) -> bool {
1232 self.0[513] & 0x10 != 0
1233 }
1234
1235 fn msb(&self) -> bool {
1236 self.0[513] & 0x8 != 0
1237 }
1238
1239 fn bit(&self) -> usize {
1240 (self.0[513] & 0x7) as usize
1241 }
1242
1243 fn block_len(&self) -> (usize, usize) {
1245 let bit = self.bit();
1246 match self.wrap() {
1247 Some((col, end)) => (col / dec(bit) * enc(bit), col + end.len()),
1248 None => (enc(bit), dec(bit)),
1249 }
1250 }
1251
1252 fn wrap(&self) -> Option<(usize, &[u8])> {
1253 if self.0.len() <= 515 {
1254 return None;
1255 }
1256 Some((self.0[514] as usize, &self.0[515 ..]))
1257 }
1258
1259 fn has_ignore(&self) -> bool {
1260 self.0.len() >= 515
1261 }
1262
1263 #[must_use]
1269 pub fn encode_len(&self, len: usize) -> usize {
1270 dispatch! {
1271 let bit: usize = self.bit();
1272 let pad: Option<u8> = self.pad();
1273 let wrap: Option<(usize, &[u8])> = self.wrap();
1274 encode_wrap_len(bit, pad, wrap, len)
1275 }
1276 }
1277
1278 #[allow(clippy::cognitive_complexity)]
1298 pub fn encode_mut(&self, input: &[u8], output: &mut [u8]) {
1299 assert_eq!(output.len(), self.encode_len(input.len()));
1300 dispatch! {
1301 let bit: usize = self.bit();
1302 let msb: bool = self.msb();
1303 let pad: Option<u8> = self.pad();
1304 let wrap: Option<(usize, &[u8])> = self.wrap();
1305 encode_wrap_mut(bit, msb, self.sym(), pad, wrap, input, output)
1306 }
1307 }
1308
1309 #[cfg(feature = "alloc")]
1322 pub fn encode_append(&self, input: &[u8], output: &mut String) {
1323 let output = unsafe { output.as_mut_vec() };
1324 let output_len = output.len();
1325 output.resize(output_len + self.encode_len(input.len()), 0u8);
1326 self.encode_mut(input, &mut output[output_len ..]);
1327 }
1328
1329 #[cfg(feature = "alloc")]
1333 pub fn new_encoder<'a>(&'a self, output: &'a mut String) -> Encoder<'a> {
1334 Encoder::new(self, output)
1335 }
1336
1337 pub fn encode_write(
1346 &self, input: &[u8], output: &mut impl core::fmt::Write,
1347 ) -> core::fmt::Result {
1348 self.encode_write_buffer(input, output, &mut [0; 1024])
1349 }
1350
1351 pub fn encode_write_buffer(
1361 &self, input: &[u8], output: &mut impl core::fmt::Write, buffer: &mut [u8],
1362 ) -> core::fmt::Result {
1363 assert!(510 <= buffer.len());
1364 let (enc, dec) = self.block_len();
1365 for input in input.chunks(buffer.len() / dec * enc) {
1366 let buffer = &mut buffer[.. self.encode_len(input.len())];
1367 self.encode_mut(input, buffer);
1368 output.write_str(unsafe { core::str::from_utf8_unchecked(buffer) })?;
1369 }
1370 Ok(())
1371 }
1372
1373 #[cfg(feature = "alloc")]
1382 #[must_use]
1383 pub fn encode(&self, input: &[u8]) -> String {
1384 let mut output = vec![0u8; self.encode_len(input.len())];
1385 self.encode_mut(input, &mut output);
1386 unsafe { String::from_utf8_unchecked(output) }
1387 }
1388
1389 pub fn decode_len(&self, len: usize) -> Result<usize, DecodeError> {
1402 let (ilen, olen) = dispatch! {
1403 let bit: usize = self.bit();
1404 let pad: bool = self.pad().is_some();
1405 decode_wrap_len(bit, pad, len)
1406 };
1407 check!(
1408 DecodeError { position: ilen, kind: DecodeKind::Length },
1409 self.has_ignore() || len == ilen
1410 );
1411 Ok(olen)
1412 }
1413
1414 #[allow(clippy::cognitive_complexity)]
1452 pub fn decode_mut(&self, input: &[u8], output: &mut [u8]) -> Result<usize, DecodePartial> {
1453 assert_eq!(Ok(output.len()), self.decode_len(input.len()));
1454 dispatch! {
1455 let bit: usize = self.bit();
1456 let msb: bool = self.msb();
1457 let pad: bool = self.pad().is_some();
1458 let has_ignore: bool = self.has_ignore();
1459 decode_wrap_mut(bit, msb, self.ctb(), self.val(), pad, has_ignore,
1460 input, output)
1461 }
1462 }
1463
1464 #[cfg(feature = "alloc")]
1494 pub fn decode(&self, input: &[u8]) -> Result<Vec<u8>, DecodeError> {
1495 let mut output = vec![0u8; self.decode_len(input.len())?];
1496 let len = self.decode_mut(input, &mut output).map_err(|partial| partial.error)?;
1497 output.truncate(len);
1498 Ok(output)
1499 }
1500
1501 #[must_use]
1503 pub fn bit_width(&self) -> usize {
1504 self.bit()
1505 }
1506
1507 #[must_use]
1516 pub fn is_canonical(&self) -> bool {
1517 if !self.ctb() {
1518 return false;
1519 }
1520 let bit = self.bit();
1521 let sym = self.sym();
1522 let val = self.val();
1523 for i in 0 .. 256 {
1524 if val[i] == INVALID {
1525 continue;
1526 }
1527 if val[i] >= 1 << bit {
1528 return false;
1529 }
1530 if sym[val[i] as usize] as usize != i {
1531 return false;
1532 }
1533 }
1534 true
1535 }
1536
1537 #[allow(clippy::missing_panics_doc)] #[cfg(feature = "alloc")]
1540 #[must_use]
1541 pub fn specification(&self) -> Specification {
1542 let mut specification = Specification::new();
1543 specification
1544 .symbols
1545 .push_str(core::str::from_utf8(&self.sym()[0 .. 1 << self.bit()]).unwrap());
1546 specification.bit_order =
1547 if self.msb() { MostSignificantFirst } else { LeastSignificantFirst };
1548 specification.check_trailing_bits = self.ctb();
1549 if let Some(pad) = self.pad() {
1550 specification.padding = Some(pad as char);
1551 }
1552 for i in 0 .. 128u8 {
1553 if self.val()[i as usize] != IGNORE {
1554 continue;
1555 }
1556 specification.ignore.push(i as char);
1557 }
1558 if let Some((col, end)) = self.wrap() {
1559 specification.wrap.width = col;
1560 specification.wrap.separator = core::str::from_utf8(end).unwrap().to_owned();
1561 }
1562 for i in 0 .. 128u8 {
1563 let canonical = if self.val()[i as usize] < 1 << self.bit() {
1564 self.sym()[self.val()[i as usize] as usize]
1565 } else if self.val()[i as usize] == PADDING {
1566 self.pad().unwrap()
1567 } else {
1568 continue;
1569 };
1570 if i == canonical {
1571 continue;
1572 }
1573 specification.translate.from.push(i as char);
1574 specification.translate.to.push(canonical as char);
1575 }
1576 specification
1577 }
1578
1579 #[doc(hidden)]
1580 #[must_use]
1581 pub const fn internal_new(implementation: &'static [u8]) -> Encoding {
1582 #[cfg(feature = "alloc")]
1583 let encoding = Encoding(Cow::Borrowed(implementation));
1584 #[cfg(not(feature = "alloc"))]
1585 let encoding = Encoding(implementation);
1586 encoding
1587 }
1588
1589 #[doc(hidden)]
1590 #[must_use]
1591 pub fn internal_implementation(&self) -> &[u8] {
1592 &self.0
1593 }
1594}
1595
1596#[derive(Debug)]
1617#[cfg(feature = "alloc")]
1618pub struct Encoder<'a> {
1619 encoding: &'a Encoding,
1620 output: &'a mut String,
1621 buffer: [u8; 255],
1622 length: u8,
1623}
1624
1625#[cfg(feature = "alloc")]
1626impl<'a> Drop for Encoder<'a> {
1627 fn drop(&mut self) {
1628 self.encoding.encode_append(&self.buffer[.. self.length as usize], self.output);
1629 }
1630}
1631
1632#[cfg(feature = "alloc")]
1633impl<'a> Encoder<'a> {
1634 fn new(encoding: &'a Encoding, output: &'a mut String) -> Self {
1635 Encoder { encoding, output, buffer: [0; 255], length: 0 }
1636 }
1637
1638 pub fn append(&mut self, mut input: &[u8]) {
1640 #[allow(clippy::cast_possible_truncation)] let max = self.encoding.block_len().0 as u8;
1642 if self.length != 0 {
1643 let len = self.length;
1644 #[allow(clippy::cast_possible_truncation)] let add = core::cmp::min((max - len) as usize, input.len()) as u8;
1646 self.buffer[len as usize ..][.. add as usize].copy_from_slice(&input[.. add as usize]);
1647 self.length += add;
1648 input = &input[add as usize ..];
1649 if self.length != max {
1650 debug_assert!(self.length < max);
1651 debug_assert!(input.is_empty());
1652 return;
1653 }
1654 self.encoding.encode_append(&self.buffer[.. max as usize], self.output);
1655 self.length = 0;
1656 }
1657 let len = floor(input.len(), max as usize);
1658 self.encoding.encode_append(&input[.. len], self.output);
1659 input = &input[len ..];
1660 #[allow(clippy::cast_possible_truncation)] let len = input.len() as u8;
1662 self.buffer[.. len as usize].copy_from_slice(input);
1663 self.length = len;
1664 }
1665
1666 pub fn finalize(self) {}
1671}
1672
1673#[derive(Debug, Copy, Clone)]
1674#[cfg(feature = "alloc")]
1675enum SpecificationErrorImpl {
1676 BadSize,
1677 NotAscii,
1678 Duplicate(u8),
1679 ExtraPadding,
1680 WrapLength,
1681 WrapWidth(u8),
1682 FromTo,
1683 Undefined(u8),
1684}
1685#[cfg(feature = "alloc")]
1686use crate::SpecificationErrorImpl::*;
1687
1688#[derive(Debug, Copy, Clone)]
1690#[cfg(feature = "alloc")]
1691pub struct SpecificationError(SpecificationErrorImpl);
1692
1693#[cfg(feature = "alloc")]
1694impl core::fmt::Display for SpecificationError {
1695 fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
1696 match self.0 {
1697 BadSize => write!(f, "invalid number of symbols"),
1698 NotAscii => write!(f, "non-ascii character"),
1699 Duplicate(c) => write!(f, "{:?} has conflicting definitions", c as char),
1700 ExtraPadding => write!(f, "unnecessary padding"),
1701 WrapLength => write!(f, "invalid wrap width or separator length"),
1702 WrapWidth(x) => write!(f, "wrap width not a multiple of {}", x),
1703 FromTo => write!(f, "translate from/to length mismatch"),
1704 Undefined(c) => write!(f, "{:?} is undefined", c as char),
1705 }
1706 }
1707}
1708
1709#[cfg(feature = "std")]
1710impl std::error::Error for SpecificationError {
1711 fn description(&self) -> &str {
1712 match self.0 {
1713 BadSize => "invalid number of symbols",
1714 NotAscii => "non-ascii character",
1715 Duplicate(_) => "conflicting definitions",
1716 ExtraPadding => "unnecessary padding",
1717 WrapLength => "invalid wrap width or separator length",
1718 WrapWidth(_) => "wrap width not a multiple",
1719 FromTo => "translate from/to length mismatch",
1720 Undefined(_) => "undefined character",
1721 }
1722 }
1723}
1724
1725#[cfg(feature = "alloc")]
1726impl Specification {
1727 #[must_use]
1729 pub fn new() -> Specification {
1730 Specification {
1731 symbols: String::new(),
1732 bit_order: MostSignificantFirst,
1733 check_trailing_bits: true,
1734 padding: None,
1735 ignore: String::new(),
1736 wrap: Wrap { width: 0, separator: String::new() },
1737 translate: Translate { from: String::new(), to: String::new() },
1738 }
1739 }
1740
1741 pub fn encoding(&self) -> Result<Encoding, SpecificationError> {
1747 let symbols = self.symbols.as_bytes();
1748 let bit: u8 = match symbols.len() {
1749 2 => 1,
1750 4 => 2,
1751 8 => 3,
1752 16 => 4,
1753 32 => 5,
1754 64 => 6,
1755 _ => return Err(SpecificationError(BadSize)),
1756 };
1757 let mut values = [INVALID; 128];
1758 let set = |v: &mut [u8; 128], i: u8, x: u8| {
1759 check!(SpecificationError(NotAscii), i < 128);
1760 if v[i as usize] == x {
1761 return Ok(());
1762 }
1763 check!(SpecificationError(Duplicate(i)), v[i as usize] == INVALID);
1764 v[i as usize] = x;
1765 Ok(())
1766 };
1767 for (v, symbols) in symbols.iter().enumerate() {
1768 #[allow(clippy::cast_possible_truncation)] set(&mut values, *symbols, v as u8)?;
1770 }
1771 let msb = self.bit_order == MostSignificantFirst;
1772 let ctb = self.check_trailing_bits || 8 % bit == 0;
1773 let pad = match self.padding {
1774 None => None,
1775 Some(pad) => {
1776 check!(SpecificationError(ExtraPadding), 8 % bit != 0);
1777 check!(SpecificationError(NotAscii), pad.len_utf8() == 1);
1778 set(&mut values, pad as u8, PADDING)?;
1779 Some(pad as u8)
1780 }
1781 };
1782 for i in self.ignore.bytes() {
1783 set(&mut values, i, IGNORE)?;
1784 }
1785 let wrap = if self.wrap.separator.is_empty() || self.wrap.width == 0 {
1786 None
1787 } else {
1788 let col = self.wrap.width;
1789 let end = self.wrap.separator.as_bytes();
1790 check!(SpecificationError(WrapLength), col < 256 && end.len() < 256);
1791 #[allow(clippy::cast_possible_truncation)] let col = col as u8;
1793 #[allow(clippy::cast_possible_truncation)] let dec = dec(bit as usize) as u8;
1795 check!(SpecificationError(WrapWidth(dec)), col % dec == 0);
1796 for &i in end {
1797 set(&mut values, i, IGNORE)?;
1798 }
1799 Some((col, end))
1800 };
1801 let from = self.translate.from.as_bytes();
1802 let to = self.translate.to.as_bytes();
1803 check!(SpecificationError(FromTo), from.len() == to.len());
1804 for i in 0 .. from.len() {
1805 check!(SpecificationError(NotAscii), to[i] < 128);
1806 let v = values[to[i] as usize];
1807 check!(SpecificationError(Undefined(to[i])), v != INVALID);
1808 set(&mut values, from[i], v)?;
1809 }
1810 let mut encoding = Vec::new();
1811 for _ in 0 .. 256 / symbols.len() {
1812 encoding.extend_from_slice(symbols);
1813 }
1814 encoding.extend_from_slice(&values);
1815 encoding.extend_from_slice(&[INVALID; 128]);
1816 match pad {
1817 None => encoding.push(INVALID),
1818 Some(pad) => encoding.push(pad),
1819 }
1820 encoding.push(bit);
1821 if msb {
1822 encoding[513] |= 0x08;
1823 }
1824 if ctb {
1825 encoding[513] |= 0x10;
1826 }
1827 if let Some((col, end)) = wrap {
1828 encoding.push(col);
1829 encoding.extend_from_slice(end);
1830 } else if values.contains(&IGNORE) {
1831 encoding.push(0);
1832 }
1833 Ok(Encoding(Cow::Owned(encoding)))
1834 }
1835}
1836
1837pub const HEXLOWER: Encoding = Encoding::internal_new(HEXLOWER_IMPL);
1857const HEXLOWER_IMPL: &[u8] = &[
1858 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 97, 98, 99, 100, 101, 102, 48, 49, 50, 51, 52, 53, 54,
1859 55, 56, 57, 97, 98, 99, 100, 101, 102, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 97, 98, 99, 100,
1860 101, 102, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 97, 98, 99, 100, 101, 102, 48, 49, 50, 51,
1861 52, 53, 54, 55, 56, 57, 97, 98, 99, 100, 101, 102, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 97,
1862 98, 99, 100, 101, 102, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 97, 98, 99, 100, 101, 102, 48,
1863 49, 50, 51, 52, 53, 54, 55, 56, 57, 97, 98, 99, 100, 101, 102, 48, 49, 50, 51, 52, 53, 54, 55,
1864 56, 57, 97, 98, 99, 100, 101, 102, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 97, 98, 99, 100,
1865 101, 102, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 97, 98, 99, 100, 101, 102, 48, 49, 50, 51,
1866 52, 53, 54, 55, 56, 57, 97, 98, 99, 100, 101, 102, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 97,
1867 98, 99, 100, 101, 102, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 97, 98, 99, 100, 101, 102, 48,
1868 49, 50, 51, 52, 53, 54, 55, 56, 57, 97, 98, 99, 100, 101, 102, 48, 49, 50, 51, 52, 53, 54, 55,
1869 56, 57, 97, 98, 99, 100, 101, 102, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
1870 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
1871 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 0, 1, 2,
1872 3, 4, 5, 6, 7, 8, 9, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
1873 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
1874 128, 128, 128, 128, 128, 10, 11, 12, 13, 14, 15, 128, 128, 128, 128, 128, 128, 128, 128, 128,
1875 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
1876 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
1877 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
1878 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
1879 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
1880 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
1881 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
1882 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 28,
1883];
1884
1885pub const HEXLOWER_PERMISSIVE: Encoding = Encoding::internal_new(HEXLOWER_PERMISSIVE_IMPL);
1914const HEXLOWER_PERMISSIVE_IMPL: &[u8] = &[
1915 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 97, 98, 99, 100, 101, 102, 48, 49, 50, 51, 52, 53, 54,
1916 55, 56, 57, 97, 98, 99, 100, 101, 102, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 97, 98, 99, 100,
1917 101, 102, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 97, 98, 99, 100, 101, 102, 48, 49, 50, 51,
1918 52, 53, 54, 55, 56, 57, 97, 98, 99, 100, 101, 102, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 97,
1919 98, 99, 100, 101, 102, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 97, 98, 99, 100, 101, 102, 48,
1920 49, 50, 51, 52, 53, 54, 55, 56, 57, 97, 98, 99, 100, 101, 102, 48, 49, 50, 51, 52, 53, 54, 55,
1921 56, 57, 97, 98, 99, 100, 101, 102, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 97, 98, 99, 100,
1922 101, 102, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 97, 98, 99, 100, 101, 102, 48, 49, 50, 51,
1923 52, 53, 54, 55, 56, 57, 97, 98, 99, 100, 101, 102, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 97,
1924 98, 99, 100, 101, 102, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 97, 98, 99, 100, 101, 102, 48,
1925 49, 50, 51, 52, 53, 54, 55, 56, 57, 97, 98, 99, 100, 101, 102, 48, 49, 50, 51, 52, 53, 54, 55,
1926 56, 57, 97, 98, 99, 100, 101, 102, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
1927 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
1928 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 0, 1, 2,
1929 3, 4, 5, 6, 7, 8, 9, 128, 128, 128, 128, 128, 128, 128, 10, 11, 12, 13, 14, 15, 128, 128, 128,
1930 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
1931 128, 128, 128, 128, 10, 11, 12, 13, 14, 15, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
1932 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
1933 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
1934 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
1935 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
1936 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
1937 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
1938 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
1939 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 28,
1940];
1941
1942pub const HEXUPPER: Encoding = Encoding::internal_new(HEXUPPER_IMPL);
1966const HEXUPPER_IMPL: &[u8] = &[
1967 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 65, 66, 67, 68, 69, 70, 48, 49, 50, 51, 52, 53, 54, 55,
1968 56, 57, 65, 66, 67, 68, 69, 70, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 65, 66, 67, 68, 69, 70,
1969 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 65, 66, 67, 68, 69, 70, 48, 49, 50, 51, 52, 53, 54, 55,
1970 56, 57, 65, 66, 67, 68, 69, 70, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 65, 66, 67, 68, 69, 70,
1971 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 65, 66, 67, 68, 69, 70, 48, 49, 50, 51, 52, 53, 54, 55,
1972 56, 57, 65, 66, 67, 68, 69, 70, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 65, 66, 67, 68, 69, 70,
1973 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 65, 66, 67, 68, 69, 70, 48, 49, 50, 51, 52, 53, 54, 55,
1974 56, 57, 65, 66, 67, 68, 69, 70, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 65, 66, 67, 68, 69, 70,
1975 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 65, 66, 67, 68, 69, 70, 48, 49, 50, 51, 52, 53, 54, 55,
1976 56, 57, 65, 66, 67, 68, 69, 70, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 65, 66, 67, 68, 69, 70,
1977 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 65, 66, 67, 68, 69, 70, 128, 128, 128, 128, 128, 128,
1978 128, 128, 128, 128, 128, 128, 128, 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, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 128, 128, 128, 128, 128, 128, 128, 10, 11,
1981 12, 13, 14, 15, 128, 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, 128, 128, 128, 128, 128, 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, 28,
1991];
1992
1993pub const HEXUPPER_PERMISSIVE: Encoding = Encoding::internal_new(HEXUPPER_PERMISSIVE_IMPL);
2015const HEXUPPER_PERMISSIVE_IMPL: &[u8] = &[
2016 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 65, 66, 67, 68, 69, 70, 48, 49, 50, 51, 52, 53, 54, 55,
2017 56, 57, 65, 66, 67, 68, 69, 70, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 65, 66, 67, 68, 69, 70,
2018 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 65, 66, 67, 68, 69, 70, 48, 49, 50, 51, 52, 53, 54, 55,
2019 56, 57, 65, 66, 67, 68, 69, 70, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 65, 66, 67, 68, 69, 70,
2020 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 65, 66, 67, 68, 69, 70, 48, 49, 50, 51, 52, 53, 54, 55,
2021 56, 57, 65, 66, 67, 68, 69, 70, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 65, 66, 67, 68, 69, 70,
2022 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 65, 66, 67, 68, 69, 70, 48, 49, 50, 51, 52, 53, 54, 55,
2023 56, 57, 65, 66, 67, 68, 69, 70, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 65, 66, 67, 68, 69, 70,
2024 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 65, 66, 67, 68, 69, 70, 48, 49, 50, 51, 52, 53, 54, 55,
2025 56, 57, 65, 66, 67, 68, 69, 70, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 65, 66, 67, 68, 69, 70,
2026 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 65, 66, 67, 68, 69, 70, 128, 128, 128, 128, 128, 128,
2027 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
2028 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
2029 128, 128, 128, 128, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 128, 128, 128, 128, 128, 128, 128, 10, 11,
2030 12, 13, 14, 15, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
2031 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 10, 11, 12, 13, 14, 15, 128, 128, 128, 128,
2032 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
2033 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
2034 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
2035 128, 128, 128, 128, 128, 128, 128, 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, 128, 128,
2038 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
2039 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 28,
2040];
2041
2042pub const BASE32: Encoding = Encoding::internal_new(BASE32_IMPL);
2058const BASE32_IMPL: &[u8] = &[
2059 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88,
2060 89, 90, 50, 51, 52, 53, 54, 55, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80,
2061 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 50, 51, 52, 53, 54, 55, 65, 66, 67, 68, 69, 70, 71, 72,
2062 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 50, 51, 52, 53, 54, 55,
2063 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88,
2064 89, 90, 50, 51, 52, 53, 54, 55, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80,
2065 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 50, 51, 52, 53, 54, 55, 65, 66, 67, 68, 69, 70, 71, 72,
2066 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 50, 51, 52, 53, 54, 55,
2067 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88,
2068 89, 90, 50, 51, 52, 53, 54, 55, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80,
2069 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 50, 51, 52, 53, 54, 55, 128, 128, 128, 128, 128, 128,
2070 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
2071 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
2072 128, 128, 128, 128, 128, 128, 26, 27, 28, 29, 30, 31, 128, 128, 128, 128, 128, 130, 128, 128,
2073 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,
2074 25, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
2075 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
2076 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
2077 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
2078 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
2079 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
2080 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
2081 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
2082 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 61, 29,
2083];
2084
2085pub const BASE32_NOPAD: Encoding = Encoding::internal_new(BASE32_NOPAD_IMPL);
2096const BASE32_NOPAD_IMPL: &[u8] = &[
2097 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88,
2098 89, 90, 50, 51, 52, 53, 54, 55, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80,
2099 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 50, 51, 52, 53, 54, 55, 65, 66, 67, 68, 69, 70, 71, 72,
2100 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 50, 51, 52, 53, 54, 55,
2101 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88,
2102 89, 90, 50, 51, 52, 53, 54, 55, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80,
2103 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 50, 51, 52, 53, 54, 55, 65, 66, 67, 68, 69, 70, 71, 72,
2104 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 50, 51, 52, 53, 54, 55,
2105 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88,
2106 89, 90, 50, 51, 52, 53, 54, 55, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80,
2107 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 50, 51, 52, 53, 54, 55, 128, 128, 128, 128, 128, 128,
2108 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
2109 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
2110 128, 128, 128, 128, 128, 128, 26, 27, 28, 29, 30, 31, 128, 128, 128, 128, 128, 128, 128, 128,
2111 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,
2112 25, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
2113 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
2114 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
2115 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
2116 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
2117 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
2118 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
2119 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
2120 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 29,
2121];
2122
2123pub const BASE32HEX: Encoding = Encoding::internal_new(BASE32HEX_IMPL);
2139const BASE32HEX_IMPL: &[u8] = &[
2140 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78,
2141 79, 80, 81, 82, 83, 84, 85, 86, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 65, 66, 67, 68, 69, 70,
2142 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 48, 49, 50, 51, 52, 53, 54, 55,
2143 56, 57, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86,
2144 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78,
2145 79, 80, 81, 82, 83, 84, 85, 86, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 65, 66, 67, 68, 69, 70,
2146 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 48, 49, 50, 51, 52, 53, 54, 55,
2147 56, 57, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86,
2148 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78,
2149 79, 80, 81, 82, 83, 84, 85, 86, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 65, 66, 67, 68, 69, 70,
2150 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 128, 128, 128, 128, 128, 128,
2151 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
2152 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
2153 128, 128, 128, 128, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 128, 128, 128, 130, 128, 128, 128, 10, 11,
2154 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 128, 128, 128,
2155 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
2156 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
2157 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
2158 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
2159 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
2160 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
2161 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
2162 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
2163 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 61, 29,
2164];
2165
2166pub const BASE32HEX_NOPAD: Encoding = Encoding::internal_new(BASE32HEX_NOPAD_IMPL);
2177const BASE32HEX_NOPAD_IMPL: &[u8] = &[
2178 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78,
2179 79, 80, 81, 82, 83, 84, 85, 86, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 65, 66, 67, 68, 69, 70,
2180 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 48, 49, 50, 51, 52, 53, 54, 55,
2181 56, 57, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86,
2182 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78,
2183 79, 80, 81, 82, 83, 84, 85, 86, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 65, 66, 67, 68, 69, 70,
2184 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 48, 49, 50, 51, 52, 53, 54, 55,
2185 56, 57, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86,
2186 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78,
2187 79, 80, 81, 82, 83, 84, 85, 86, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 65, 66, 67, 68, 69, 70,
2188 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 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, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 128, 128, 128, 128, 128, 128, 128, 10, 11,
2192 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 128, 128, 128,
2193 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
2194 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
2195 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
2196 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
2197 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
2198 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
2199 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
2200 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
2201 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 29,
2202];
2203
2204pub const BASE32_DNSSEC: Encoding = Encoding::internal_new(BASE32_DNSSEC_IMPL);
2225const BASE32_DNSSEC_IMPL: &[u8] = &[
2226 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107,
2227 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57,
2228 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115,
2229 116, 117, 118, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 97, 98, 99, 100, 101, 102, 103, 104,
2230 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 48, 49, 50, 51, 52, 53,
2231 54, 55, 56, 57, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112,
2232 113, 114, 115, 116, 117, 118, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 97, 98, 99, 100, 101,
2233 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 48, 49,
2234 50, 51, 52, 53, 54, 55, 56, 57, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109,
2235 110, 111, 112, 113, 114, 115, 116, 117, 118, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 97, 98,
2236 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117,
2237 118, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106,
2238 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 128, 128, 128, 128, 128, 128, 128,
2239 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
2240 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
2241 128, 128, 128, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 128, 128, 128, 128, 128, 128, 128, 10, 11, 12, 13,
2242 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 128, 128, 128, 128,
2243 128, 128, 128, 128, 128, 128, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25,
2244 26, 27, 28, 29, 30, 31, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
2245 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
2246 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
2247 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
2248 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
2249 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
2250 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
2251 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 29,
2252];
2253
2254#[allow(clippy::doc_markdown)]
2255pub const BASE32_DNSCURVE: Encoding = Encoding::internal_new(BASE32_DNSCURVE_IMPL);
2273const BASE32_DNSCURVE_IMPL: &[u8] = &[
2274 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 98, 99, 100, 102, 103, 104, 106, 107, 108, 109, 110,
2275 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57,
2276 98, 99, 100, 102, 103, 104, 106, 107, 108, 109, 110, 112, 113, 114, 115, 116, 117, 118, 119,
2277 120, 121, 122, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 98, 99, 100, 102, 103, 104, 106, 107,
2278 108, 109, 110, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 48, 49, 50, 51, 52, 53,
2279 54, 55, 56, 57, 98, 99, 100, 102, 103, 104, 106, 107, 108, 109, 110, 112, 113, 114, 115, 116,
2280 117, 118, 119, 120, 121, 122, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 98, 99, 100, 102, 103,
2281 104, 106, 107, 108, 109, 110, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 48, 49,
2282 50, 51, 52, 53, 54, 55, 56, 57, 98, 99, 100, 102, 103, 104, 106, 107, 108, 109, 110, 112, 113,
2283 114, 115, 116, 117, 118, 119, 120, 121, 122, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 98, 99,
2284 100, 102, 103, 104, 106, 107, 108, 109, 110, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121,
2285 122, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 98, 99, 100, 102, 103, 104, 106, 107, 108, 109,
2286 110, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 128, 128, 128, 128, 128, 128, 128,
2287 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
2288 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
2289 128, 128, 128, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 128, 128, 128, 128, 128, 128, 128, 128, 10, 11,
2290 12, 128, 13, 14, 15, 128, 16, 17, 18, 19, 20, 128, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31,
2291 128, 128, 128, 128, 128, 128, 128, 10, 11, 12, 128, 13, 14, 15, 128, 16, 17, 18, 19, 20, 128,
2292 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
2293 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
2294 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
2295 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
2296 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 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, 128, 128, 128, 128, 128, 128, 21,
2300];
2301
2302pub const BASE64: Encoding = Encoding::internal_new(BASE64_IMPL);
2318const BASE64_IMPL: &[u8] = &[
2319 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88,
2320 89, 90, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114,
2321 115, 116, 117, 118, 119, 120, 121, 122, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 43, 47, 65, 66,
2322 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90,
2323 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115,
2324 116, 117, 118, 119, 120, 121, 122, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 43, 47, 65, 66, 67,
2325 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 97,
2326 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116,
2327 117, 118, 119, 120, 121, 122, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 43, 47, 65, 66, 67, 68,
2328 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 97, 98,
2329 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117,
2330 118, 119, 120, 121, 122, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 43, 47, 128, 128, 128, 128,
2331 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
2332 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
2333 128, 62, 128, 128, 128, 63, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 128, 128, 128, 130, 128,
2334 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,
2335 24, 25, 128, 128, 128, 128, 128, 128, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39,
2336 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 128, 128, 128, 128, 128, 128, 128, 128, 128,
2337 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
2338 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
2339 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 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, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
2343 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 61, 30,
2344];
2345
2346pub const BASE64_NOPAD: Encoding = Encoding::internal_new(BASE64_NOPAD_IMPL);
2357const BASE64_NOPAD_IMPL: &[u8] = &[
2358 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88,
2359 89, 90, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114,
2360 115, 116, 117, 118, 119, 120, 121, 122, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 43, 47, 65, 66,
2361 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90,
2362 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115,
2363 116, 117, 118, 119, 120, 121, 122, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 43, 47, 65, 66, 67,
2364 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 97,
2365 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116,
2366 117, 118, 119, 120, 121, 122, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 43, 47, 65, 66, 67, 68,
2367 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 97, 98,
2368 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117,
2369 118, 119, 120, 121, 122, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 43, 47, 128, 128, 128, 128,
2370 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
2371 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
2372 128, 62, 128, 128, 128, 63, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 128, 128, 128, 128, 128,
2373 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,
2374 24, 25, 128, 128, 128, 128, 128, 128, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39,
2375 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 128, 128, 128, 128, 128, 128, 128, 128, 128,
2376 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
2377 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 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, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
2381 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
2382 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 30,
2383];
2384
2385pub const BASE64_MIME: Encoding = Encoding::internal_new(BASE64_MIME_IMPL);
2404const BASE64_MIME_IMPL: &[u8] = &[
2405 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88,
2406 89, 90, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114,
2407 115, 116, 117, 118, 119, 120, 121, 122, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 43, 47, 65, 66,
2408 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90,
2409 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115,
2410 116, 117, 118, 119, 120, 121, 122, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 43, 47, 65, 66, 67,
2411 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 97,
2412 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116,
2413 117, 118, 119, 120, 121, 122, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 43, 47, 65, 66, 67, 68,
2414 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 97, 98,
2415 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117,
2416 118, 119, 120, 121, 122, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 43, 47, 128, 128, 128, 128,
2417 128, 128, 128, 128, 128, 128, 129, 128, 128, 129, 128, 128, 128, 128, 128, 128, 128, 128, 128,
2418 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
2419 128, 62, 128, 128, 128, 63, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 128, 128, 128, 130, 128,
2420 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,
2421 24, 25, 128, 128, 128, 128, 128, 128, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39,
2422 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 128, 128, 128, 128, 128, 128, 128, 128, 128,
2423 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
2424 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
2425 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
2426 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
2427 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 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, 61, 30, 76, 13, 10,
2430];
2431
2432pub const BASE64_MIME_PERMISSIVE: Encoding = Encoding::internal_new(BASE64_MIME_PERMISSIVE_IMPL);
2452const BASE64_MIME_PERMISSIVE_IMPL: &[u8] = &[
2453 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88,
2454 89, 90, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114,
2455 115, 116, 117, 118, 119, 120, 121, 122, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 43, 47, 65, 66,
2456 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90,
2457 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115,
2458 116, 117, 118, 119, 120, 121, 122, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 43, 47, 65, 66, 67,
2459 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 97,
2460 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116,
2461 117, 118, 119, 120, 121, 122, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 43, 47, 65, 66, 67, 68,
2462 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 97, 98,
2463 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117,
2464 118, 119, 120, 121, 122, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 43, 47, 128, 128, 128, 128,
2465 128, 128, 128, 128, 128, 128, 129, 128, 128, 129, 128, 128, 128, 128, 128, 128, 128, 128, 128,
2466 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
2467 128, 62, 128, 128, 128, 63, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 128, 128, 128, 130, 128,
2468 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,
2469 24, 25, 128, 128, 128, 128, 128, 128, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39,
2470 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 128, 128, 128, 128, 128, 128, 128, 128, 128,
2471 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
2472 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
2473 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
2474 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
2475 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 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, 61, 14, 76, 13, 10,
2478];
2479
2480pub const BASE64URL: Encoding = Encoding::internal_new(BASE64URL_IMPL);
2496const BASE64URL_IMPL: &[u8] = &[
2497 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88,
2498 89, 90, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114,
2499 115, 116, 117, 118, 119, 120, 121, 122, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 45, 95, 65, 66,
2500 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90,
2501 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115,
2502 116, 117, 118, 119, 120, 121, 122, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 45, 95, 65, 66, 67,
2503 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 97,
2504 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116,
2505 117, 118, 119, 120, 121, 122, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 45, 95, 65, 66, 67, 68,
2506 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 97, 98,
2507 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117,
2508 118, 119, 120, 121, 122, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 45, 95, 128, 128, 128, 128,
2509 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
2510 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
2511 128, 128, 128, 62, 128, 128, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 128, 128, 128, 130, 128,
2512 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,
2513 24, 25, 128, 128, 128, 128, 63, 128, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39,
2514 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 128, 128, 128, 128, 128, 128, 128, 128, 128,
2515 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
2516 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
2517 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
2518 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
2519 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 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, 61, 30,
2522];
2523
2524pub const BASE64URL_NOPAD: Encoding = Encoding::internal_new(BASE64URL_NOPAD_IMPL);
2535const BASE64URL_NOPAD_IMPL: &[u8] = &[
2536 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88,
2537 89, 90, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114,
2538 115, 116, 117, 118, 119, 120, 121, 122, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 45, 95, 65, 66,
2539 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90,
2540 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115,
2541 116, 117, 118, 119, 120, 121, 122, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 45, 95, 65, 66, 67,
2542 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 97,
2543 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116,
2544 117, 118, 119, 120, 121, 122, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 45, 95, 65, 66, 67, 68,
2545 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 97, 98,
2546 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117,
2547 118, 119, 120, 121, 122, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 45, 95, 128, 128, 128, 128,
2548 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
2549 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
2550 128, 128, 128, 62, 128, 128, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 128, 128, 128, 128, 128,
2551 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,
2552 24, 25, 128, 128, 128, 128, 63, 128, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39,
2553 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 128, 128, 128, 128, 128, 128, 128, 128, 128,
2554 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
2555 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
2556 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
2557 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
2558 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 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, 30,
2561];