#include<iostream>
#include<string>
#include<Windows.h>
using namespace std;
CONST BYTE defaultKey = 0x66;
string defaultString = "你好啊,哈哈哈";
void StringXorEncrypt(string& sg, const BYTE &key= defaultKey){
for (unsigned short i = 0; i <= sg.size();i++) {
sg[i] = (sg[i] ^ key);
}
}
int main() {
cout <<"加密前:"<< defaultString << endl;
StringXorEncrypt(defaultString);
cout <<"加密后:"<< defaultString << endl;
StringXorEncrypt(defaultString);
cout << "还原后:" << defaultString << endl;
}
转载请注明原文地址:https://blackberry.8miu.com/read-13394.html