diff options
Diffstat (limited to 'src/lib/util/crypto.hpp')
-rw-r--r-- | src/lib/util/crypto.hpp | 18 |
1 files changed, 18 insertions, 0 deletions
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<unsigned char*>(message_digest)); + + return std::string(message_digest, sizeof(message_digest)); + +} +#endif /* CRYPTO_HPP */ + |