File indexing completed on 2024-05-05 05:53:13

0001 /*
0002  * SPDX-License-Identifier: GPL-3.0-or-later
0003  * SPDX-FileCopyrightText: 2020 Johan Ouwerkerk <jm.ouwerkerk@gmail.com>
0004  */
0005 #ifndef HMAC_H
0006 #define HMAC_H
0007 
0008 #include <QByteArray>
0009 #include <QCryptographicHash>
0010 
0011 #include <optional>
0012 
0013 namespace hmac
0014 {
0015     std::optional<int> blockSize(QCryptographicHash::Algorithm algorithm);
0016     std::optional<uint> outputSize(QCryptographicHash::Algorithm algorithm);
0017 
0018     bool validateKeySize(QCryptographicHash::Algorithm algorithm, int ksize, bool requireSaneKeyLength = false);
0019     std::optional<QByteArray> compute(QCryptographicHash::Algorithm algorithm, char * rawKey, int ksize, const QByteArray &message, bool requireSaneKeyLength = false);
0020 }
0021 
0022 #endif