//加密
void
HelloWorld::encode(std::string &str)
{
for
(
int
i =
0
; i < str.length(); i++) {
int
ch = str[i];
ch = ch ^
1
;
str[i] = ch;
}
}
//解密
void
HelloWorld::decode(std::string &str)
{
for
(
int
i =
0
; i < str.length(); i++) {
int
ch = str[i];
ch = ch ^
1
;
str[i] = ch;
}
}
转自:http://www.2cto.com/kf/201406/306946.html