-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbase64.h
17 lines (16 loc) · 921 Bytes
/
base64.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
/*
* Base64 encodes the input byte array. Uses the standard character set, including '/' and '+' and includes padding at the end if needed.
* input: array of bytes
* size: length of input
* eSize: pointer to a place to store the final encoded string's length
* returns: pointer to string. Free this pointer when done using it. Returns NULL if there was an error.
*/
char *base64encode(uint8_t *input, unsigned long size, unsigned long *eSize);
/*
* Base64 decodes the input string. Expects the standard char set including '/' and '+'. Padding characters at the end are not required.
* input: base64 encoded string
* size: length of input
* dSize: pointer to a place to store the decoded array's length
* returns: array of bytes. Free this pointer when done using it. Returns NULL if input is malformed or there was some error.
*/
uint8_t *base64decode(char *input, unsigned long size, unsigned long *dSize);