17#include <trantor/exports.h>
36TRANTOR_EXPORT std::string
toUtf8(
const std::wstring &wstr);
45TRANTOR_EXPORT std::wstring
fromUtf8(
const std::string &str);
63TRANTOR_EXPORT std::string
fromWidePath(
const std::wstring &strPath);
83TRANTOR_EXPORT std::wstring
toWidePath(
const std::string &strUtf8Path);
87#if defined(_WIN32) && !defined(__MINGW32__)
103inline std::wstring
toNativePath(
const std::string &strPath)
118inline const std::wstring &
toNativePath(
const std::wstring &strPath)
182 unsigned char bytes[16];
187 unsigned char bytes[20];
192 unsigned char bytes[32];
204 return md5(str.data(), str.size());
213 return sha1(str.data(), str.size());
222 return sha256(str.data(), str.size());
231 return sha3(str.data(), str.size());
243 return blake2b(str.data(), str.size());
252TRANTOR_EXPORT std::string
toHexString(
const void *data,
size_t len);
255 return toHexString(hash.bytes,
sizeof(hash.bytes));
260 return toHexString(hash.bytes,
sizeof(hash.bytes));
265 return toHexString(hash.bytes,
sizeof(hash.bytes));
Trantor helper functions.
Definition Utilities.h:27
TRANTOR_EXPORT bool secureRandomBytes(void *ptr, size_t size)
Generates cryptographically secure random bytes.
TRANTOR_EXPORT Hash160 sha1(const void *data, size_t len)
Compute the SHA1 hash of the given data.
TRANTOR_EXPORT std::string tlsBackend()
Returns the TLS backend used by trantor. Could be "None", "OpenSSL" or "Botan".
TRANTOR_EXPORT std::string fromWidePath(const std::wstring &strPath)
TRANTOR_EXPORT Hash256 blake2b(const void *data, size_t len)
Compute the BLAKE2b hash of the given data.
TRANTOR_EXPORT std::wstring toWidePath(const std::string &strUtf8Path)
TRANTOR_EXPORT Hash128 md5(const void *data, size_t len)
Compute the MD5 hash of the given data.
TRANTOR_EXPORT std::wstring fromUtf8(const std::string &str)
Convert a UTF-8 string to a wide string.
const std::string & toNativePath(const std::string &strPath)
Definition Utilities.h:134
TRANTOR_EXPORT Hash256 sha256(const void *data, size_t len)
Compute the SHA256 hash of the given data.
TRANTOR_EXPORT std::string toHexString(const void *data, size_t len)
hex encode the given data
const std::string & fromNativePath(const std::string &strPath)
Definition Utilities.h:161
TRANTOR_EXPORT std::string toUtf8(const std::wstring &wstr)
Convert a wide string to a UTF-8.
TRANTOR_EXPORT Hash256 sha3(const void *data, size_t len)
Compute the SHA3 hash of the given data.
Definition EventLoop.h:34
Definition Utilities.h:181
Definition Utilities.h:186
Definition Utilities.h:191