有没有什么函数,对于给定的非加密输入,返回加密数据,而对于加密输入,返回解密数据?
像这样的东西。
char *text = "This text is being encrypted.";
crypto(text);
//Now "text" is equal to "uhabD143Adev9123CAegawgawash"
crypto(text);
//Now "text" is equal to "This text is being encrypted."它没有真正的用处。只是为了演示。我不会在真正的应用程序上使用它。
发布于 2015-03-05 10:28:29
如果同样的函数可以加密和解密,那么它实际上就不是加密:)不管怎样,xor应该可以很好地工作:
void crypto(char* text, char key) {
for (; *text; ++text) *text ^= key;
}https://stackoverflow.com/questions/28868590
复制相似问题