2020-05-22 13:18:41 +00:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2013-2020, The PurpleI2P Project
|
|
|
|
*
|
|
|
|
* This file is part of Purple i2pd project and licensed under BSD3
|
|
|
|
*
|
|
|
|
* See full license text in LICENSE file at top of project tree
|
|
|
|
*/
|
|
|
|
|
2015-11-03 14:15:49 +00:00
|
|
|
#ifndef BASE_H__
|
|
|
|
#define BASE_H__
|
|
|
|
|
|
|
|
#include <inttypes.h>
|
|
|
|
#include <string>
|
2016-02-18 18:19:31 +00:00
|
|
|
#include <iostream>
|
2015-11-03 14:15:49 +00:00
|
|
|
|
2016-06-28 00:00:00 +00:00
|
|
|
namespace i2p {
|
|
|
|
namespace data {
|
2015-11-03 14:15:49 +00:00
|
|
|
size_t ByteStreamToBase64 (const uint8_t * InBuffer, size_t InCount, char * OutBuffer, size_t len);
|
|
|
|
size_t Base64ToByteStream (const char * InBuffer, size_t InCount, uint8_t * OutBuffer, size_t len );
|
2016-02-18 00:00:00 +00:00
|
|
|
const char * GetBase32SubstitutionTable ();
|
2018-01-06 03:48:51 +00:00
|
|
|
const char * GetBase64SubstitutionTable ();
|
|
|
|
|
2015-11-03 14:15:49 +00:00
|
|
|
size_t Base32ToByteStream (const char * inBuf, size_t len, uint8_t * outBuf, size_t outLen);
|
|
|
|
size_t ByteStreamToBase32 (const uint8_t * InBuf, size_t len, char * outBuf, size_t outLen);
|
|
|
|
|
2020-03-01 10:25:50 +00:00
|
|
|
/**
|
|
|
|
Compute the size for a buffer to contain encoded base64 given that the size of the input is input_size bytes
|
|
|
|
*/
|
2018-04-06 19:23:56 +00:00
|
|
|
size_t Base64EncodingBufferSize(const size_t input_size);
|
2020-03-01 10:25:50 +00:00
|
|
|
|
|
|
|
std::string ToBase64Standard (const std::string& in); // using standard table, for Proxy-Authorization
|
|
|
|
|
2016-06-28 00:00:00 +00:00
|
|
|
} // data
|
|
|
|
} // i2p
|
2015-11-03 14:15:49 +00:00
|
|
|
|
|
|
|
#endif
|