M5Unit-CRYPTO 0.0.1 git rev:e7369a6
Loading...
Searching...
No Matches
base64.hpp
Go to the documentation of this file.
1/*
2 * SPDX-FileCopyrightText: 2025 M5Stack Technology CO LTD
3 *
4 * SPDX-License-Identifier: MIT
5 */
10#ifndef M5_UNIT_CRYPTO_UTILITY_BASE64_HPP
11#define M5_UNIT_CRYPTO_UTILITY_BASE64_HPP
12
13#include <cstdint>
14
15namespace m5 {
16namespace utility {
17
29uint32_t encode_base64(char* out, const uint32_t olen, const uint8_t* buf, const uint32_t blen, const uint8_t line_len,
30 const bool urlEncode, const bool padding);
31
33inline bool encodeBase64(char* out, const uint32_t olen, const uint8_t* buf, const uint32_t blen)
34{
35 return encode_base64(out, olen, buf, blen, 64, false, true);
36}
38inline bool encodeBase64URL(char* out, const uint32_t olen, const uint8_t* buf, const uint32_t blen)
39{
40 return encode_base64(out, olen, buf, blen, 0, true, false);
41}
42
43} // namespace utility
44} // namespace m5
45#endif
uint32_t 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
Definition base64.cpp:21
bool encodeBase64(char *out, const uint32_t olen, const uint8_t *buf, const uint32_t blen)
Encode Base64(PEM)
Definition base64.hpp:33
bool encodeBase64URL(char *out, const uint32_t olen, const uint8_t *buf, const uint32_t blen)
Encode Base64URL.
Definition base64.hpp:38
Top level namespace of M5stack.