summaryrefslogtreecommitdiffstats
path: root/tests/libfuzzer/corelib/tools/qcryptographichash/result/main.cpp
blob: 738da38e296e0266a6ff7c13d85da249d2c4d552 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
// Copyright (C) 2020 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only

#include <QCryptographicHash>

extern "C" int LLVMFuzzerTestOneInput(const char *Data, size_t Size) {
    for (QCryptographicHash::Algorithm algo = QCryptographicHash::Md4;
         algo <= QCryptographicHash::RealSha3_512;
         algo = QCryptographicHash::Algorithm(algo + 1)) {
        QCryptographicHash qh(algo);
        qh.addData(QByteArray::fromRawData(Data, Size));
        qh.result();
    }
    return 0;
}