mirror of
https://github.com/monero-project/monero-gui.git
synced 2024-12-24 04:29:23 +00:00
updater: use monero tools::sha256sum
This commit is contained in:
parent
c8f4355e15
commit
ff4de8e8f7
2 changed files with 12 additions and 4 deletions
|
@ -421,6 +421,13 @@ macx {
|
||||||
INCLUDEPATH += /usr/local/include
|
INCLUDEPATH += /usr/local/include
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SODIUM_DIR = $$system(brew --prefix libsodium, lines, EXIT_CODE)
|
||||||
|
equals(EXIT_CODE, 0) {
|
||||||
|
INCLUDEPATH += $$SODIUM_DIR/include
|
||||||
|
} else {
|
||||||
|
INCLUDEPATH += /usr/local/include
|
||||||
|
}
|
||||||
|
|
||||||
QT += macextras
|
QT += macextras
|
||||||
OBJECTIVE_SOURCES += src/qt/macoshelper.mm
|
OBJECTIVE_SOURCES += src/qt/macoshelper.mm
|
||||||
LIBS+= -Wl,-dead_strip
|
LIBS+= -Wl,-dead_strip
|
||||||
|
|
|
@ -28,6 +28,8 @@
|
||||||
|
|
||||||
#include "updater.h"
|
#include "updater.h"
|
||||||
|
|
||||||
|
#include <common/util.h>
|
||||||
|
|
||||||
#include <openpgp/hash.h>
|
#include <openpgp/hash.h>
|
||||||
|
|
||||||
#include "network.h"
|
#include "network.h"
|
||||||
|
@ -111,10 +113,9 @@ QPair<QString, QString> Updater::verifySignaturesAndHashSum(
|
||||||
|
|
||||||
QByteArray Updater::getHash(const void *data, size_t size) const
|
QByteArray Updater::getHash(const void *data, size_t size) const
|
||||||
{
|
{
|
||||||
openpgp::hash hasher(openpgp::hash::algorithm::sha256);
|
QByteArray hash(sizeof(crypto::hash), 0);
|
||||||
hasher << epee::span<const uint8_t>(reinterpret_cast<const uint8_t *>(data), size);
|
tools::sha256sum(static_cast<const uint8_t *>(data), size, *reinterpret_cast<crypto::hash *>(hash.data()));
|
||||||
const std::vector<uint8_t> hash = hasher.finish();
|
return hash;
|
||||||
return QByteArray(reinterpret_cast<const char *>(&hash[0]), hash.size());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QByteArray Updater::parseShasumOutput(const QString &message, const QString &filename) const
|
QByteArray Updater::parseShasumOutput(const QString &message, const QString &filename) const
|
||||||
|
|
Loading…
Reference in a new issue