summaryrefslogtreecommitdiffstats
path: root/src/corelib/tools/qmessageauthenticationcode.cpp
diff options
context:
space:
mode:
authorLinus Jahn <lnj@kaidan.im>2019-11-28 19:42:23 +0100
committerLinus Jahn <lnj@kaidan.im>2020-07-31 15:05:18 +0200
commit5d69aa3ee1214cf689e2357bff8688f2ff138471 (patch)
tree7889ec6c3761977faea4f659d867c8a5ba6a3e35 /src/corelib/tools/qmessageauthenticationcode.cpp
parent06f7a24574376fae099f276337f5564d27a5787b (diff)
QCryptographicHash: Add BLAKE2b and BLAKE2s hashing algorithms
BLAKE2 does not specify requirements about specific hash sizes and since QCryptographicHash does not support dynamic hash sizes, only the most common hash sizes could be covered by this. The supported hash sizes were chosen to match the ones supported by the Linux kernel. The new hashing algorithms for QCryptographicHash are: * BLAKE2b (160 bit, 256 bit, 384 bit, 512 bit) * BLAKE2s (128 bit, 160 bit, 224 bit, 256 bit) [ChangeLog][QtCore][QCryptographicHash] Added BLAKE2b and BLAKE2s hashing algorithms. Fixes: QTBUG-78198 Change-Id: Id9e0180a974093982fdf1cdd6180988a2e5e9f4f Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'src/corelib/tools/qmessageauthenticationcode.cpp')
-rw-r--r--src/corelib/tools/qmessageauthenticationcode.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/corelib/tools/qmessageauthenticationcode.cpp b/src/corelib/tools/qmessageauthenticationcode.cpp
index 40a11936220..d84b1b0b6cb 100644
--- a/src/corelib/tools/qmessageauthenticationcode.cpp
+++ b/src/corelib/tools/qmessageauthenticationcode.cpp
@@ -75,6 +75,8 @@
// sha1.h - commented out '#include <stdint.h>' on line 74
#include "../../3rdparty/rfc6234/sha.h"
+#include "../../3rdparty/blake2/src/blake2.h"
+
#undef uint64_t
#undef uint32_t
#undef uint68_t
@@ -111,6 +113,16 @@ static int qt_hash_block_size(QCryptographicHash::Algorithm method)
case QCryptographicHash::RealSha3_512:
case QCryptographicHash::Keccak_512:
return 72;
+ case QCryptographicHash::Blake2b_160:
+ case QCryptographicHash::Blake2b_256:
+ case QCryptographicHash::Blake2b_384:
+ case QCryptographicHash::Blake2b_512:
+ return BLAKE2B_BLOCKBYTES;
+ case QCryptographicHash::Blake2s_128:
+ case QCryptographicHash::Blake2s_160:
+ case QCryptographicHash::Blake2s_224:
+ case QCryptographicHash::Blake2s_256:
+ return BLAKE2S_BLOCKBYTES;
}
return 0;
}