Fixed digest

This commit is contained in:
WolverinDEV 2019-07-06 15:00:05 +02:00
parent 107d752cb8
commit 8882410f35

View File

@ -32,20 +32,20 @@
#else
#include <openssl/sha.h>
#define DECLARE_DIGEST(name, method, digestLength) \
inline std::string name(const std::string& input) { \
u_char buffer[digestLength]; \
method((u_char*) input.data(), input.length(), buffer); \
return std::string((const char*) buffer, digestLength); \
} \
\
inline std::string name(const char* input, ssize_t length = -1) { \
if(length == -1) length = strlen(input); \
return name(std::string(input, length)); \
} \
\
#define DECLARE_DIGEST(name, method, digestLength) \
inline std::string name(const std::string& input) { \
u_char buffer[digestLength]; \
method((u_char*) input.data(), input.length(), buffer); \
return std::string((const char*) buffer, digestLength); \
} \
\
inline std::string name(const char* input, ssize_t length = -1) { \
if(length == -1) length = strlen(input); \
return name(std::string(input, digestLength)); \
} \
\
inline void name(const char* input, size_t length, uint8_t(& result)[digestLength]) { \
method((u_char*) input, length, result); \
method((u_char*) input, length, digestLength); \
}
#endif