tables.c 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. #include "tables.h"
  2. const uint8_t
  3. base64_table_enc_6bit[] =
  4. "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
  5. "abcdefghijklmnopqrstuvwxyz"
  6. "0123456789"
  7. "+/";
  8. // In the lookup table below, note that the value for '=' (character 61) is
  9. // 254, not 255. This character is used for in-band signaling of the end of
  10. // the datastream, and we will use that later. The characters A-Z, a-z, 0-9
  11. // and + / are mapped to their "decoded" values. The other bytes all map to
  12. // the value 255, which flags them as "invalid input".
  13. const uint8_t
  14. base64_table_dec_8bit[] =
  15. {
  16. 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, // 0..15
  17. 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, // 16..31
  18. 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 62, 255, 255, 255, 63, // 32..47
  19. 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 255, 255, 255, 254, 255, 255, // 48..63
  20. 255, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, // 64..79
  21. 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 255, 255, 255, 255, 255, // 80..95
  22. 255, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, // 96..111
  23. 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 255, 255, 255, 255, 255, // 112..127
  24. 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, // 128..143
  25. 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
  26. 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
  27. 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
  28. 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
  29. 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
  30. 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
  31. 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
  32. };
  33. #if BASE64_WORDSIZE >= 32
  34. # include "table_dec_32bit.h"
  35. # include "table_enc_12bit.h"
  36. #endif