Add support for various algorithms for kdbx4

* Add SHA512 support to CryptoHash
* Add ChaCha20 support
* Add HMAC support
* Add new HmacBlockStream, used in KDBX 4
* Add support for ChaCha20 protected stream
This commit is contained in:
angelsl 2017-11-13 02:23:01 +08:00 committed by Jonathan White
parent 4532108678
commit 6a0d05e1ef
No known key found for this signature in database
GPG key ID: 440FC65F2E0C6E01
23 changed files with 616 additions and 25 deletions

View file

@ -44,4 +44,17 @@ void TestCryptoHash::test()
cryptoHash3.addData(QString("ssX").toLatin1());
QCOMPARE(cryptoHash3.result(),
QByteArray::fromHex("0b56e5f65263e747af4a833bd7dd7ad26a64d7a4de7c68e52364893dca0766b4"));
CryptoHash cryptoHash2(CryptoHash::Sha512);
QCOMPARE(cryptoHash2.result(),
QByteArray::fromHex("cf83e1357eefb8bdf1542850d66d8007d620e4050b5715dc83f4a921d36ce9ce47d0d13c5d85f2b0ff8318d2877eec2f63b931bd47417a81a538327af927da3e"));
QByteArray result3 = CryptoHash::hash(source2, CryptoHash::Sha512);
QCOMPARE(result3, QByteArray::fromHex("0d41b612584ed39ff72944c29494573e40f4bb95283455fae2e0be1e3565aa9f48057d59e6ffd777970e282871c25a549a2763e5b724794f312c97021c42f91d"));
CryptoHash cryptoHash4(CryptoHash::Sha512);
cryptoHash4.addData(QString("KeePa").toLatin1());
cryptoHash4.addData(QString("ssX").toLatin1());
QCOMPARE(cryptoHash4.result(),
QByteArray::fromHex("0d41b612584ed39ff72944c29494573e40f4bb95283455fae2e0be1e3565aa9f48057d59e6ffd777970e282871c25a549a2763e5b724794f312c97021c42f91d"));
}