2020-05-23 17:50:59 +02:00
|
|
|
#ifndef ACCELERATEDCRYPTOGRAPHICHASH_H
|
|
|
|
#define ACCELERATEDCRYPTOGRAPHICHASH_H
|
|
|
|
|
|
|
|
/*
|
|
|
|
* SPDX-License-Identifier: Apache-2.0
|
|
|
|
* Copyright (C) 2020 Raspberry Pi (Trading) Limited
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <QCryptographicHash>
|
2020-05-25 00:36:16 +02:00
|
|
|
|
|
|
|
#ifdef Q_OS_DARWIN
|
|
|
|
typedef QCryptographicHash AcceleratedCryptographicHash;
|
|
|
|
#else
|
|
|
|
|
2020-05-23 17:50:59 +02:00
|
|
|
#include "openssl/sha.h"
|
|
|
|
|
|
|
|
class AcceleratedCryptographicHash
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
explicit AcceleratedCryptographicHash(QCryptographicHash::Algorithm method);
|
|
|
|
virtual ~AcceleratedCryptographicHash();
|
|
|
|
void addData(const char *data, int length);
|
|
|
|
void addData(const QByteArray &data);
|
|
|
|
QByteArray result();
|
|
|
|
|
|
|
|
protected:
|
|
|
|
SHA256_CTX _sha256;
|
|
|
|
};
|
|
|
|
|
2020-05-25 00:36:16 +02:00
|
|
|
#endif
|
2020-05-23 17:50:59 +02:00
|
|
|
#endif // ACCELERATEDCRYPTOGRAPHICHASH_H
|