【发布时间】:2014-04-30 22:47:06
【问题描述】:
我很难实现blowfish encryption algorythm。
谁能给我解释一下, 如果这是发生加密的函数:
void encrypt (uint32_t & L, uint32_t & R) {
for (int i=0 ; i<16 ; i += 2) {
L ^= P[i];
R ^= f(L);
R ^= P[i+1];
L ^= f(R);
}
L ^= P[16];
R ^= P[17];
swap (L, R);
}
那么这样的函数会是什么样子:
/**
*
* @param string text this is the text to be encrypted
* @return string this is encrypted text
*/
string EncryptBlowfish(string text){
//something happens here
}
【问题讨论】:
-
Blowfish 可能是最容易理解且最优雅的加密方式。
-
如果您阅读您提供的链接的
key_schedule函数,您会看到加密发生的位置。encrypt函数对块中的 2 个连续单词进行操作。 -
开箱即用的代码很难理解,而且我没有找到任何可以流畅阅读的示例。你有任何@ZacHowland
-
@user3325976 我建议您投资Applied Cryptography 以开始使用。
标签: c++ encryption encryption-symmetric blowfish