trantor
Non-blocking I/O cross-platform TCP network library, using C++14
Loading...
Searching...
No Matches
Utilities.h File Reference
#include <trantor/exports.h>
#include <string>
Include dependency graph for Utilities.h:

Go to the source code of this file.

Classes

struct  trantor::utils::Hash128
struct  trantor::utils::Hash160
struct  trantor::utils::Hash256

Namespaces

namespace  trantor
namespace  trantor::utils
 Trantor helper functions.

Functions

TRANTOR_EXPORT std::string trantor::utils::toUtf8 (const std::wstring &wstr)
 Convert a wide string to a UTF-8.
TRANTOR_EXPORT std::wstring trantor::utils::fromUtf8 (const std::string &str)
 Convert a UTF-8 string to a wide string.
TRANTOR_EXPORT std::string trantor::utils::fromWidePath (const std::wstring &strPath)
TRANTOR_EXPORT std::wstring trantor::utils::toWidePath (const std::string &strUtf8Path)
const std::string & trantor::utils::toNativePath (const std::string &strPath)
std::string trantor::utils::toNativePath (const std::wstring &strPath)
const std::string & trantor::utils::fromNativePath (const std::string &strPath)
std::string trantor::utils::fromNativePath (const std::wstring &strPath)
TRANTOR_EXPORT std::string trantor::utils::tlsBackend ()
 Returns the TLS backend used by trantor. Could be "None", "OpenSSL" or "Botan".
TRANTOR_EXPORT Hash128 trantor::utils::md5 (const void *data, size_t len)
 Compute the MD5 hash of the given data.
Hash128 trantor::utils::md5 (const std::string &str)
TRANTOR_EXPORT Hash160 trantor::utils::sha1 (const void *data, size_t len)
 Compute the SHA1 hash of the given data.
Hash160 trantor::utils::sha1 (const std::string &str)
TRANTOR_EXPORT Hash256 trantor::utils::sha256 (const void *data, size_t len)
 Compute the SHA256 hash of the given data.
Hash256 trantor::utils::sha256 (const std::string &str)
TRANTOR_EXPORT Hash256 trantor::utils::sha3 (const void *data, size_t len)
 Compute the SHA3 hash of the given data.
Hash256 trantor::utils::sha3 (const std::string &str)
TRANTOR_EXPORT Hash256 trantor::utils::blake2b (const void *data, size_t len)
 Compute the BLAKE2b hash of the given data.
Hash256 trantor::utils::blake2b (const std::string &str)
TRANTOR_EXPORT std::string trantor::utils::toHexString (const void *data, size_t len)
 hex encode the given data
std::string trantor::utils::toHexString (const Hash128 &hash)
std::string trantor::utils::toHexString (const Hash160 &hash)
std::string trantor::utils::toHexString (const Hash256 &hash)
TRANTOR_EXPORT bool trantor::utils::secureRandomBytes (void *ptr, size_t size)
 Generates cryptographically secure random bytes.

Detailed Description

Author
An Tao

Copyright 2018, An Tao. All rights reserved. https://github.com/an-tao/drogon Use of this source code is governed by a MIT license that can be found in the License file.

Drogon