1#ifndef MSTL_CORE_ENCRYPT_XOR_HPP__
2#define MSTL_CORE_ENCRYPT_XOR_HPP__
3#include "../string/string.hpp"
8 static bstring encrypt(bstring_view
data, bstring_view key);
9 static bstring decrypt(bstring_view
data, bstring_view key) {
return encrypt(
data, key); }
13MSTL_ALWAYS_INLINE_INLINE bstring xor_encrypt(
const bstring&
data,
const bstring& key) {
14 return XOR::encrypt(
data.view(), key.view());
16MSTL_ALWAYS_INLINE_INLINE
string xor_encrypt(
const string&
data,
const string& key) {
17 return to_string(xor_encrypt(to_bstring(
data), to_bstring(key)));
19MSTL_ALWAYS_INLINE_INLINE bstring xor_decrypt(
const bstring&
data,
const bstring& key) {
20 return XOR::decrypt(
data.view(), key.view());
22MSTL_ALWAYS_INLINE_INLINE
string xor_decrypt(
const string&
data,
const string& key) {
23 return to_string(xor_decrypt(to_bstring(
data), to_bstring(key)));
26MSTL_ALWAYS_INLINE_INLINE bstring xor_encrypt(
const bstring_view
data,
const bstring_view key) {
27 return XOR::encrypt(
data, key);
29MSTL_ALWAYS_INLINE_INLINE bstring xor_decrypt(
const bstring_view
data,
const bstring_view key) {
30 return XOR::decrypt(
data, key);
#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()))
获取容器的底层数据指针