diff options
| author | Linus Jahn <lnj@kaidan.im> | 2022-10-01 18:53:44 +0200 |
|---|---|---|
| committer | Linus Jahn <lnj@kaidan.im> | 2022-10-01 18:56:28 +0200 |
| commit | e1d1b5c7655be6545b6e27687d29c53139949dbd (patch) | |
| tree | 2969c3985b3e54d6997b49678052cb8b0eaf80a2 /src/client/QXmppFileSharingManager.cpp | |
| parent | a4753a2c56e720c03936e6891792c98462482c3c (diff) | |
| download | qxmpp-e1d1b5c7655be6545b6e27687d29c53139949dbd.tar.gz | |
FileSharingManager: Also generate SHA3-256 or BLAKE2b256 hashes
The file sharing manager now generates SHA-256+SHA3-256 with Qt 5 and
SHA-256+BLAKE2b256 with Qt 6.
Diffstat (limited to 'src/client/QXmppFileSharingManager.cpp')
| -rw-r--r-- | src/client/QXmppFileSharingManager.cpp | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/src/client/QXmppFileSharingManager.cpp b/src/client/QXmppFileSharingManager.cpp index c72b9632..54e29086 100644 --- a/src/client/QXmppFileSharingManager.cpp +++ b/src/client/QXmppFileSharingManager.cpp @@ -32,6 +32,19 @@ using namespace QXmpp::Private; using MetadataGenerator = QXmppFileSharingManager::MetadataGenerator; using MetadataGeneratorResult = QXmppFileSharingManager::MetadataGeneratorResult; +// The manager generates a hash with each hash algorithm +static std::vector<HashAlgorithm> hashAlgorithms() +{ + return { + HashAlgorithm::Sha256, +#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) + HashAlgorithm::Blake2b_256, +#else + HashAlgorithm::Sha3_256, +#endif + }; +} + class QXmppFileSharingManagerPrivate { public: @@ -116,7 +129,7 @@ std::shared_ptr<QXmppUpload> QXmppFileSharingManager::sendFile(std::shared_ptr<Q }; auto metadataFuture = d->metadataGenerator(openFile()); - auto hashesFuture = calculateHashes(openFile(), { HashAlgorithm::Sha256 }); + auto hashesFuture = calculateHashes(openFile(), hashAlgorithms()); upload = provider->uploadFile(openFile(), metadata); upload->metadata = metadata; |
