updated BITMESSAGE_SIZE_LIMIT
added EncodeBase64/DecodeBase64 to Utils::String
This commit is contained in:
parent
bd7faf2b32
commit
a82aab26fa
@ -1,6 +1,6 @@
|
|||||||
#define UPLOAD_URL "https://reich.io/upload.php"
|
#define UPLOAD_URL "https://reich.io/upload.php"
|
||||||
#define BITMESSAGE_UPLOAD_IDENTITY "BM-NBhqCHraxGyUT38cfhRQYWx29gJ7QePa"
|
#define BITMESSAGE_UPLOAD_IDENTITY "BM-NBhqCHraxGyUT38cfhRQYWx29gJ7QePa"
|
||||||
#define BITMESSAGE_SIZE_LIMIT 25600
|
#define BITMESSAGE_SIZE_LIMIT 230000
|
||||||
|
|
||||||
namespace Components
|
namespace Components
|
||||||
{
|
{
|
||||||
|
@ -117,7 +117,7 @@ namespace Utils
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Encodes a given string in Base64
|
// Encodes a given string in Base64
|
||||||
std::string encodeBase64(const char* input, const unsigned long inputSize) {
|
std::string EncodeBase64(const char* input, const unsigned long inputSize) {
|
||||||
unsigned long outlen = long(inputSize + (inputSize / 3.0) + 16);
|
unsigned long outlen = long(inputSize + (inputSize / 3.0) + 16);
|
||||||
unsigned char* outbuf = new unsigned char[outlen]; //Reserve output memory
|
unsigned char* outbuf = new unsigned char[outlen]; //Reserve output memory
|
||||||
base64_encode((unsigned char*)input, inputSize, outbuf, &outlen);
|
base64_encode((unsigned char*)input, inputSize, outbuf, &outlen);
|
||||||
@ -127,8 +127,18 @@ namespace Utils
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Encodes a given string in Base64
|
// Encodes a given string in Base64
|
||||||
std::string encodeBase64(const std::string& input) {
|
std::string EncodeBase64(const std::string& input) {
|
||||||
return encodeBase64(input.c_str(), input.size());
|
return EncodeBase64(input.c_str(), input.size());
|
||||||
|
}
|
||||||
|
|
||||||
|
// Decodes a given string from Base64
|
||||||
|
std::string DecodeBase64(const std::string& input) {
|
||||||
|
unsigned char* out = new unsigned char[input.size()];
|
||||||
|
unsigned long outlen = input.size();
|
||||||
|
base64_decode((unsigned char*)input.c_str(), input.size(), out, &outlen);
|
||||||
|
std::string ret((char*)out, outlen);
|
||||||
|
delete[] out;
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -40,7 +40,8 @@ namespace Utils
|
|||||||
|
|
||||||
std::string XOR(std::string str, char value);
|
std::string XOR(std::string str, char value);
|
||||||
|
|
||||||
std::string encodeBase64(const char* input, const unsigned long inputSize);
|
std::string EncodeBase64(const char* input, const unsigned long inputSize);
|
||||||
std::string encodeBase64(const std::string& input);
|
std::string EncodeBase64(const std::string& input);
|
||||||
|
std::string DecodeBase64(const std::string& input);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user