From 63e3f487751eb096152e6e6bd90d8b47643a496b Mon Sep 17 00:00:00 2001 From: Miodrag Milanovic Date: Wed, 4 Jan 2017 16:15:57 +0100 Subject: Added initial HTTP/HTTPS webserver/websocket server support (nw) --- src/lib/util/crypto.hpp | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 src/lib/util/crypto.hpp (limited to 'src/lib/util/crypto.hpp') diff --git a/src/lib/util/crypto.hpp b/src/lib/util/crypto.hpp new file mode 100644 index 00000000000..705aad6a375 --- /dev/null +++ b/src/lib/util/crypto.hpp @@ -0,0 +1,18 @@ +// license:MIT +// copyright-holders:Miodrag Milanovic +#ifndef CRYPTO_HPP +#define CRYPTO_HPP + +#include "base64.hpp" +#include "sha1.hpp" + +inline std::string sha1_encode(const std::string& input) +{ + char message_digest[20]; + sha1::calc(input.c_str(),input.length(),reinterpret_cast(message_digest)); + + return std::string(message_digest, sizeof(message_digest)); + +} +#endif /* CRYPTO_HPP */ + -- cgit v1.2.3-70-g09d2