Closed pa-sowa closed 1 year ago
Please run the test program for ChaCha and XChaCha. The ChaCha test vectors were generated using Bernstein's reference implementation. The XChaCha were taken from the RFC, if I recall correctly.
$ ./cryptest.exe tv chacha
Using seed: 1672061537
Testing SymmetricCipher algorithm ChaCha.
..............................................................................
Tests complete. Total tests = 78. Failed tests = 0.
Also note that the IETF changed Bernstein's algorithm and called it ChaCha, too. As far as I know, Bernstein's ChaCha and the IETF's ChaCha are not always compatible. The IETF should have used a different name to avoid confusing users.
Also see https://www.cryptopp.com/wiki/ChaCha20, https://www.cryptopp.com/wiki/ChaChaTLS and https://www.cryptopp.com/wiki/XChaCha20 .
Crypto++ XChaCha20 implementation cannot decrypt data that both
libsodium
and Go'sgolang.org/x/crypto
decrypt correctly. Do I need to do it differently with Crypto++? I couldn't find a way to make it work.Below is a proof of concept program that uses
libsodium
to encrypt and Crypto++ to decrypt, which doesn't work as expected:Crypto++ version: 8.6.0-2ubuntu1 Operating system: Ubuntu 22.04 x86_64
Build:
g++ -o test test.cpp -lsodium -lcrypto++