gpt4 book ai didi

cryptography - Crypto++ AES 解密如何?

转载 作者:行者123 更新时间:2023-12-04 04:43:01 24 4
gpt4 key购买 nike

那里几乎没有加密++ 的新手指南。或者无论如何我都没有找到。我想要做的是解密我用另一个 AES 加密器生成的一组 uchars。我从哪里开始?我建立了图书馆并连接了盛大的图书馆。我是否需要设置任何东西,或者我只是在我的数组上调用一个函数(如果需要的话是什么函数)?

我真的很感激了解这方面知识的人的帮助。

谢谢

最佳答案

我不会说我对此“很了解”,但这里有一些我放在一起的测试代码,用于使用 AES 加密/解密字符串。扩展它以使用其他一些数据应该不会太难。

string output;
CTR_Mode<AES>::Encryption encrypt((const byte*)key,AES::DEFAULT_KEYLENGTH,(const byte*)iv);
StringSource(plaintext, true, new StreamTransformationFilter(encrypt, new StringSink(output)));
cout << "Encrypted: " << output << endl;

string res;
CTR_Mode<AES>::Decryption decrypt((const byte*)key,AES::DEFAULT_KEYLENGTH,(const byte*)iv);
StringSource(output, true, new StreamTransformationFilter(decrypt, new StringSink(res)));
cout << "Decrypted: " << res << endl;

在进行这项工作时,我发现 Crypto++ 测试程序(称为“cryptest”的 VisualStudio 项目)中的源代码提供了很大的帮助。一开始读起来有点困难,但随着你使用它会变得更容易。我还从维基百科 (http://en.wikipedia.org/wiki/Block_cipher_modes_of_operation) 中获得了很多帮助来理解可用的分组密码模式。

关于cryptography - Crypto++ AES 解密如何?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3131377/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com