NexusForce 1.0.0
A Modern C++ Library with extended functionality, web components, and utility libraries
载入中...
搜索中...
未找到
aes256.hpp
浏览该文件的文档.
1#ifndef NEFORCE_CORE_ENCRYPT_AES256_HPP__
2#define NEFORCE_CORE_ENCRYPT_AES256_HPP__
3
11
14NEFORCE_BEGIN_NAMESPACE__
15
20
71
198
199
206NEFORCE_ALWAYS_INLINE_INLINE string aes256_encrypt(const string_view data, const string_view key_hex) {
207 return AES256::encrypt_ecb_hex(data, key_hex);
208}
209
210NEFORCE_ALWAYS_INLINE_INLINE string aes256_encrypt(const string& data, const string_view key_hex) {
211 return AES256::encrypt_ecb_hex(data.view(), key_hex);
212}
213
214NEFORCE_ALWAYS_INLINE_INLINE string aes256_encrypt(const string_view data, const string& key_hex) {
215 return AES256::encrypt_ecb_hex(data, key_hex.view());
216}
217
218NEFORCE_ALWAYS_INLINE_INLINE string aes256_encrypt(const string& data, const string& key_hex) {
219 return AES256::encrypt_ecb_hex(data.view(), key_hex.view());
220}
221
228NEFORCE_ALWAYS_INLINE_INLINE string aes256_decrypt(const string_view encrypted_hex, const string_view key_hex) {
229 return AES256::decrypt_ecb_hex(encrypted_hex, key_hex);
230}
231
232NEFORCE_ALWAYS_INLINE_INLINE string aes256_decrypt(const string& encrypted_hex, const string_view key_hex) {
233 return AES256::decrypt_ecb_hex(encrypted_hex.view(), key_hex);
234}
235
236NEFORCE_ALWAYS_INLINE_INLINE string aes256_decrypt(const string_view encrypted_hex, const string& key_hex) {
237 return AES256::decrypt_ecb_hex(encrypted_hex, key_hex.view());
238}
239
240NEFORCE_ALWAYS_INLINE_INLINE string aes256_decrypt(const string& encrypted_hex, const string& key_hex) {
241 return AES256::decrypt_ecb_hex(encrypted_hex.view(), key_hex.view());
242}
243 // AES256
245 // Encryption
247
248NEFORCE_END_NAMESPACE__
249#endif // NEFORCE_CORE_ENCRYPT_AES256_HPP__
NEFORCE_NODISCARD NEFORCE_CONSTEXPR20 view_type view() const noexcept
获取字符串视图
NEFORCE_ALWAYS_INLINE_INLINE string aes256_encrypt(const string_view data, const string_view key_hex)
AES-256加密便捷函数
NEFORCE_ALWAYS_INLINE_INLINE string aes256_decrypt(const string_view encrypted_hex, const string_view key_hex)
AES-256解密便捷函数
vector< byte_t > byte_vector
字节向量类型别名
unsigned char byte_t
字节类型,定义为无符号字符
memory_view< const byte_t > cbyte_view
常量字节视图类型别名
basic_string_view< char > string_view
字符字符串视图
NEFORCE_NODISCARD NEFORCE_ALWAYS_INLINE constexpr decltype(auto) data(Container &cont) noexcept(noexcept(cont.data()))
获取容器的底层数据指针
字符串类型别名和实用函数
AES-256加密算法结构体
static byte_vector decrypt_cbc_pkcs7(cbyte_view data, cbyte_view key, cbyte_view iv)
AES-256-CBC 解密(PKCS7填充)
static string encrypt_ecb_hex(string_view data, string_view key_hex)
AES-256-ECB 加密(十六进制接口)
static byte_vector decrypt_cbc(cbyte_view data, cbyte_view key, cbyte_view iv)
AES-256-CBC 解密
static byte_vector encrypt_cbc_pkcs7(cbyte_view data, cbyte_view key, cbyte_view iv)
AES-256-CBC 加密(PKCS7填充)
static byte_vector encrypt_ecb_pkcs7(cbyte_view data, cbyte_view key)
AES-256-ECB 加密(PKCS7填充)
static byte_vector encrypt_cbc(cbyte_view data, cbyte_view key, cbyte_view iv)
AES-256-CBC 加密
static byte_vector encrypt_ecb(cbyte_view data, cbyte_view key)
AES-256-ECB 加密
static byte_vector decrypt_ecb_pkcs7(cbyte_view data, cbyte_view key)
AES-256-ECB 解密(PKCS7填充)
static byte_vector decrypt_gcm(cbyte_view data, cbyte_view key, cbyte_view iv, cbyte_view aad, cbyte_view tag, size_t tag_len)
AES-256-GCM 解密并验证标签
static string decrypt_ecb_hex(string_view encrypted_hex, string_view key_hex)
AES-256-ECB 解密(十六进制接口)
static byte_vector encrypt_gcm(cbyte_view data, cbyte_view key, cbyte_view iv, cbyte_view aad, byte_t *tag, size_t tag_len)
AES-256-GCM 加密
static byte_vector decrypt_ecb(cbyte_view data, cbyte_view key)
AES-256-ECB 解密
动态大小数组容器