MSTL 1.4.0
A Modern C++ Library with extended functionality, web components, and utility libraries
载入中...
搜索中...
未找到
sha1.hpp
1#ifndef MSTL_CORE_ENCRYPT_SHA1_HPP__
2#define MSTL_CORE_ENCRYPT_SHA1_HPP__
3#include "../string/string.hpp"
5
6class MSTL_API SHA1 {
7private:
8 static constexpr uint32_t rotleft(const uint32_t x, const uint32_t c) { return (x << c) | (x >> (32 - c)); }
9
10public:
11 static bstring hash(bstring_view data);
12 static string hash_hex(bstring_view data);
13};
14
15
16MSTL_ALWAYS_INLINE_INLINE string sha1(const bstring& data) {
17 return SHA1::hash_hex(data.view());
18}
19MSTL_ALWAYS_INLINE_INLINE string sha1(const string& data) {
20 return sha1(to_bstring(data));
21}
22
23MSTL_ALWAYS_INLINE_INLINE string sha1(const bstring_view data) {
24 return SHA1::hash_hex(data);
25}
26MSTL_ALWAYS_INLINE_INLINE string sha1(const string_view data) {
27 return sha1(to_bstring(data));
28}
29
31#endif // MSTL_CORE_ENCRYPT_SHA1_HPP__
unsigned int uint32_t
32位无符号整数类型
#define MSTL_END_NAMESPACE__
结束全局命名空间MSTL
#define MSTL_BEGIN_NAMESPACE__
开始全局命名空间MSTL
MSTL_NODISCARD MSTL_ALWAYS_INLINE constexpr decltype(auto) data(Container &cont) noexcept(noexcept(cont.data()))
获取容器的底层数据指针