笔记,省的忘了。毕竟对这个不熟
string str = "123456aaa";
char *str_char = (char*)(str.c_str());
for (int i=0; i<str.length()-1; i++) {
*(str_char+i) = *(str_char+i)^str.length();
}
cocos2d::log("111====>>>>>:%s",str_char);
for (int i=0; i<str.length()-1; i++) {
*(str_char+i) = *(str_char+i)^str.length();
}
cocos2d::log("222====>>>>>:%s",str_char);
根据字符串长度按位抑或,可以做简单加密操作