M5Utility 0.0.10 git rev:e54335a
Loading...
Searching...
No Matches
base64.cpp File Reference

base64 encoding More...

#include "base64.hpp"
#include <M5Utility.h>

Namespaces

namespace  m5
 Top level namespace of M5.
 

Functions

uint32_t m5::utility::encode_base64 (char *out, const uint32_t olen, const uint8_t *buf, const uint32_t blen, const uint8_t line_len, const bool urlEncode, const bool padding)
 encode Base64
 
uint32_t m5::utility::decode_base64 (uint8_t *out, const uint32_t olen, const char *buf, const uint32_t blen, const bool urlEncode, const bool padding)
 decode Base64 / Base64URL
 

Detailed Description

base64 encoding

Function Documentation

◆ decode_base64()

uint32_t m5::utility::decode_base64 ( uint8_t * out,
const uint32_t olen,
const char * buf,
const uint32_t blen,
const bool urlEncode,
const bool padding )

decode Base64 / Base64URL

Parameters
[out]outOutput buffer (decoded bytes)
olenOutput buffer length
bufInput buffer (base64 text; may include CR/LF/spaces)
blenInput buffer length
urlEncodebase64url decoding if true
paddingExpect/allow padding if true
Returns
Decoded length
Note
padding true: Input must contain '='’ padding (RFC 4648 standard)
padding false: Input must not contain' ='’. Incomplete groups are auto-completed

◆ encode_base64()

uint32_t m5::utility::encode_base64 ( char * out,
const uint32_t olen,
const uint8_t * buf,
const uint32_t blen,
const uint8_t line_len,
const bool urlEncode,
const bool padding )

encode Base64

Parameters
[out]outOutput buffer
olenOutput buffer length
bufInput buffer
blenInput buffer length
line_len==0 No line breaks ! =0: Line break at that number of characters
urlEncodebase64url encoding if true
paddingEnable padding if true
Returns
Encoded length