C/C++ 异或加密实现代码
一段使用C++开发实现的异或加解密方法,可用于对特定字符串数据进行数据加解密操作,方便后期调用。
std::string Encrypt(std::string content, std::string secretKey)
{
for (UINT i = 0; i < content.length(); i++)
{
content[i] ^= secretKey[i % secretKey.length()];
}
return content;
}
std::string Decrypt(std::string data, std::string secretKey)
{
for (UINT i = 0; i < data.length(); i++)
{
data[i] ^= secretKey[i % secretKey.length()];
}
return data;
}
文章出处:https://www.cnblogs.com/LyShark/articles/15086648.html
本博客所有文章除特别声明外,均采用 BY-NC-SA 许可协议。转载请注明出处!
本博客所有文章除特别声明外,均采用 BY-NC-SA 许可协议。转载请注明出处!