|
|
Go to the documentation of this file.
11 char*
k = const_cast<char*>(
key.c_str());
24 unsigned int j =
sizeof(
uInt32);
26 unsigned int output_size = 0;
33 for (
unsigned int i = 0;
i < input_size;
i += (
j * 2)) {
34 output_size =
i + 2 *
j;
36 output = (
unsigned char*)malloc(output_size);
37 memset(
output, 0, output_size);
39 for (
unsigned int i = 0;
i < input_size;
i += (
j * 2)) {
43 if (input_size >
i +
j) {
45 if (input_size >
i + 2 *
j) {
48 nr = input_size -
i -
j;
75 return bf_process_alloc(reinterpret_cast<const unsigned char*>(
input.c_str()),
input.size(),
output,
false);
82 unsigned char*
out =
nullptr;
83 size_t outSize = bf_process_alloc(
input, inputSize,
out,
true);
85 for (
i = 0;
i < outSize;
i++) {
90 char* sout = reinterpret_cast<char*>(
out);
94 for (soutSize = 0; soutSize < outSize; soutSize++)
95 if (
out[soutSize] == 0)
98 if (soutSize < outSize) {
112 unsigned char*
out =
nullptr;
113 size_t outSize = bf_process_alloc(reinterpret_cast<const unsigned char*>(
input.c_str()),
input.size(),
out,
false);
114 char* b64out =
nullptr;
125 char*
input =
nullptr;
126 size_t inputSize = 0;
128 throwException(
"Input provided is not a valid base64 string.",
"Cipher::b64decrypt");
ret
prodAgent to be discontinued
static const std::string input
std::string decrypt(const unsigned char *input, size_t inputSize)
size_t bf_process_alloc(const unsigned char *input, size_t input_size, unsigned char *&output, bool decrypt=false)
std::string b64encrypt(const std::string &input)
Cipher(const std::string &key)
size_t base64_encode_alloc(const char *in, size_t inlen, char **out)
std::string b64decrypt(const std::string &input)
void Blowfish_Decrypt(BLOWFISH_CTX *ctx, uInt32 *xl, uInt32 *xr)
size_t encrypt(const std::string &input, unsigned char *&output)
#define base64_decode_alloc(in, inlen, out, outlen)
void Blowfish_Init(BLOWFISH_CTX *ctx, unsigned char *key, int keyLen)
void throwException(const std::string &message, const std::string &methodName)
void Blowfish_Encrypt(BLOWFISH_CTX *ctx, uInt32 *xl, uInt32 *xr)