21 #ifndef COSA_BASE64_HH 22 #define COSA_BASE64_HH 54 static int encode(
char* dest,
const void* src,
size_t size);
67 static int encode_P(
char* dest,
const void* src,
size_t size);
99 static int decode(
void* dest,
const char* src,
size_t size);
103 static const char PAD =
'=';
117 static const char ENCODE[] PROGMEM;
124 static char encode(uint8_t bits)
125 __attribute__((always_inline))
127 return (pgm_read_byte(&ENCODE[bits]));
131 static const char DECODE[] PROGMEM;
138 static uint8_t
decode(
char c)
139 __attribute__((always_inline))
141 if (
UNLIKELY(c < 43 || c > 122))
return (0);
142 uint8_t bits = pgm_read_byte(&DECODE[c - 43]);
143 return (bits ==
'$' ? 0 : bits - 62);
static int decode(void *dest, const char *src, size_t size)
static int encode(char *dest, const void *src, size_t size)
static int encode_P(char *dest, const void *src, size_t size)