base64.h
Go to the documentation of this file.
1 /****
2  * Sming Framework Project - Open Source framework for high efficiency native ESP8266 development.
3  * Created 2015 by Skurydin Alexey
4  * http://github.com/SmingHub/Sming
5  * All files of the Sming Core are provided under the LGPL v3 license.
6  *
7  *
8  * @author: 2018 - Mikee47 <mike@sillyhouse.net>
9  *
10  * Functions added to work with String objects for ease of use.
11  *
12  ****/
13 
14 #pragma once
15 
16 #include "WString.h"
17 
27 int base64_encode(size_t in_len, const unsigned char* in, size_t out_len, char* out);
28 
34 String base64_encode(const unsigned char* in, size_t in_len);
35 
40 static inline String base64_encode(const String& in)
41 {
42  return base64_encode((unsigned char*)in.c_str(), in.length());
43 }
44 
52 int base64_decode(size_t in_len, const char* in, size_t out_len, unsigned char* out);
53 
59 String base64_decode(const char* in, size_t in_len);
60 
65 static inline String base64_decode(const String& in)
66 {
67  return base64_decode(in.c_str(), in.length());
68 }
int base64_encode(size_t in_len, const unsigned char *in, size_t out_len, char *out)
encode binary data into base64 digits with MIME style === pads
const char * c_str() const
Get a constant (un-modifiable) pointer to String content.
Definition: WString.h:600
The String class.
Definition: WString.h:136
size_t length(void) const
Obtain the String length in characters, excluding NUL terminator.
Definition: WString.h:228
int base64_decode(size_t in_len, const char *in, size_t out_len, unsigned char *out)
decode base64 digits with MIME style === pads into binary data