-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbase64.hpp
22 lines (19 loc) · 1.1 KB
/
base64.hpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
/***********************************************************
* Base64 library *
* @author Ahmed Elzoughby *
* @date July 23, 2017 *
* Purpose: encode and decode base64 format *
***********************************************************/
#pragma once
#include <stdlib.h>
#include <memory.h>
const char base64_map[] = { 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P',
'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', 'a', 'b', 'c', 'd', 'e', 'f',
'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v',
'w', 'x', 'y', 'z', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '+', '/' };
/***********************************************
decodes base64 format string into ASCCI string
@param plain encoded base64 format string
@return ASCII string to be encoded
***********************************************/
size_t decode_base64(unsigned char* cipher);