Adapt for latest MUtils changes.
This commit is contained in:
parent
96a62e7ac1
commit
13cc4c2adf
@ -35,7 +35,7 @@
|
||||
#define VER_LAMEXP_MINOR_LO 5
|
||||
#define VER_LAMEXP_TYPE Alpha
|
||||
#define VER_LAMEXP_PATCH 2
|
||||
#define VER_LAMEXP_BUILD 1945
|
||||
#define VER_LAMEXP_BUILD 1948
|
||||
#define VER_LAMEXP_CONFG 1934
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -23,7 +23,7 @@
|
||||
#include "FileHash.h"
|
||||
|
||||
//MUtils
|
||||
#include <MUtils/Hash_Keccak.h>
|
||||
#include <MUtils/Hash.h>
|
||||
#include <MUtils/Exception.h>
|
||||
|
||||
static const char *g_blnk = "deadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeef";
|
||||
@ -32,38 +32,28 @@ static const char *g_salt = "ee9f7bdabc170763d2200a7e3030045aafe380011aefc1730e5
|
||||
|
||||
QByteArray FileHash::computeHash(QFile &file)
|
||||
{
|
||||
QByteArray hash = QByteArray::fromHex(g_blnk).toHex();
|
||||
QByteArray result;
|
||||
|
||||
if(file.isOpen() && file.reset())
|
||||
{
|
||||
MUtils::Hash::Keccak keccak;
|
||||
QScopedPointer<MUtils::Hash::Hash> hash(MUtils::Hash::create(MUtils::Hash::HASH_KECCAK_384));
|
||||
const QByteArray data = file.readAll();
|
||||
if (data.size() >= 16)
|
||||
{
|
||||
const QByteArray seed = QByteArray::fromHex(g_seed);
|
||||
const QByteArray salt = QByteArray::fromHex(g_salt);
|
||||
if (keccak.init(MUtils::Hash::Keccak::hb384))
|
||||
|
||||
bool okay[3];
|
||||
okay[0] = hash->update(seed);
|
||||
okay[1] = hash->update(data);
|
||||
okay[2] = hash->update(salt);
|
||||
|
||||
if (okay[0] && okay[1] && okay[2])
|
||||
{
|
||||
bool ok = true;
|
||||
ok = ok && keccak.addData(seed);
|
||||
ok = ok && keccak.addData(data);
|
||||
ok = ok && keccak.addData(salt);
|
||||
if (ok)
|
||||
{
|
||||
const QByteArray digest = keccak.finalize();
|
||||
if (!digest.isEmpty()) hash = digest.toHex();
|
||||
}
|
||||
result = hash->digest(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return hash;
|
||||
}
|
||||
|
||||
void FileHash::selfTest(void)
|
||||
{
|
||||
if(!MUtils::Hash::Keccak::selfTest())
|
||||
{
|
||||
MUTILS_THROW("QKeccakHash self-test has failed!");
|
||||
}
|
||||
return result.isEmpty() ? QByteArray::fromHex(g_blnk).toHex() : result;
|
||||
}
|
||||
|
@ -25,13 +25,7 @@
|
||||
#include <QFile>
|
||||
#include <QByteArray>
|
||||
|
||||
class FileHash
|
||||
namespace FileHash
|
||||
{
|
||||
public:
|
||||
static QByteArray computeHash(QFile &file);
|
||||
static void selfTest(void);
|
||||
private:
|
||||
FileHash() {}
|
||||
~FileHash() {};
|
||||
};
|
||||
|
||||
QByteArray computeHash(QFile &file);
|
||||
}
|
||||
|
@ -209,9 +209,10 @@ static int lamexp_main(int &argc, char **argv)
|
||||
const MUtils::CPUFetaures::cpu_info_t cpuFeatures = MUtils::CPUFetaures::detect();
|
||||
qDebug(" CPU vendor id : %s (Intel=%s)", cpuFeatures.idstr, MUTILS_BOOL2STR(cpuFeatures.vendor & MUtils::CPUFetaures::VENDOR_INTEL));
|
||||
qDebug("CPU brand string : %s", cpuFeatures.brand);
|
||||
qDebug(" CPU signature : Family=%d Model=%d Stepping=%d", cpuFeatures.family, cpuFeatures.model, cpuFeatures.stepping);
|
||||
qDebug("CPU capabilities : CMOV=%s MMX=%s SSE=%s SSE2=%s SSE3=%s SSSE3=%s", MUTILS_BOOL2STR(cpuFeatures.features & MUtils::CPUFetaures::FLAG_CMOV), MUTILS_BOOL2STR(cpuFeatures.features & MUtils::CPUFetaures::FLAG_MMX), MUTILS_BOOL2STR(cpuFeatures.features & MUtils::CPUFetaures::FLAG_SSE), MUTILS_BOOL2STR(cpuFeatures.features & MUtils::CPUFetaures::FLAG_SSE2), MUTILS_BOOL2STR(cpuFeatures.features & MUtils::CPUFetaures::FLAG_SSE3), MUTILS_BOOL2STR(cpuFeatures.features & MUtils::CPUFetaures::FLAG_SSSE3));
|
||||
qDebug("CPU capabilities : SSE4.1=%s SSE4.2=%s AVX=%s EM64T/AMD64=%s", MUTILS_BOOL2STR(cpuFeatures.features & MUtils::CPUFetaures::FLAG_SSE4), MUTILS_BOOL2STR(cpuFeatures.features & MUtils::CPUFetaures::FLAG_SSE42), MUTILS_BOOL2STR(cpuFeatures.features & MUtils::CPUFetaures::FLAG_AVX), MUTILS_BOOL2STR(cpuFeatures.x64));
|
||||
qDebug(" CPU signature : Family=%d, Model=%d, Stepping=%d", cpuFeatures.family, cpuFeatures.model, cpuFeatures.stepping);
|
||||
qDebug("CPU architecture : %s", cpuFeatures.x64 ? "x64 (64-Bit)" : "x86 (32-Bit)");
|
||||
qDebug("CPU capabilities : CMOV=%s, MMX=%s, SSE=%s, SSE2=%s, SSE3=%s, SSSE3=%s", MUTILS_BOOL2STR(cpuFeatures.features & MUtils::CPUFetaures::FLAG_CMOV), MUTILS_BOOL2STR(cpuFeatures.features & MUtils::CPUFetaures::FLAG_MMX), MUTILS_BOOL2STR(cpuFeatures.features & MUtils::CPUFetaures::FLAG_SSE), MUTILS_BOOL2STR(cpuFeatures.features & MUtils::CPUFetaures::FLAG_SSE2), MUTILS_BOOL2STR(cpuFeatures.features & MUtils::CPUFetaures::FLAG_SSE3), MUTILS_BOOL2STR(cpuFeatures.features & MUtils::CPUFetaures::FLAG_SSSE3));
|
||||
qDebug("CPU capabilities : SSE4.1=%s, SSE4.2=%s, AVX=%s, AVX2=%s, FMA3=%s, LZCNT=%s", MUTILS_BOOL2STR(cpuFeatures.features & MUtils::CPUFetaures::FLAG_SSE41), MUTILS_BOOL2STR(cpuFeatures.features & MUtils::CPUFetaures::FLAG_SSE42), MUTILS_BOOL2STR(cpuFeatures.features & MUtils::CPUFetaures::FLAG_AVX), MUTILS_BOOL2STR(cpuFeatures.features & MUtils::CPUFetaures::FLAG_AVX2), MUTILS_BOOL2STR(cpuFeatures.features & MUtils::CPUFetaures::FLAG_FMA3), MUTILS_BOOL2STR(cpuFeatures.features & MUtils::CPUFetaures::FLAG_LZCNT));
|
||||
qDebug(" Number of CPU's : %d\n", cpuFeatures.count);
|
||||
|
||||
//Initialize Qt
|
||||
|
@ -422,9 +422,6 @@ double InitializationThread::doInit(const size_t threadCount)
|
||||
|
||||
QScopedPointer<QThreadPool> pool(new QThreadPool());
|
||||
pool->setMaxThreadCount((threadCount > 0) ? threadCount : qBound(2U, cores2threads(m_cpuFeatures.count), EXPECTED_TOOL_COUNT));
|
||||
/* qWarning("Using %u threads for extraction.", pool->maxThreadCount()); */
|
||||
|
||||
FileHash::selfTest();
|
||||
ExtractorTask::clearFlags();
|
||||
|
||||
//Start the timer
|
||||
@ -741,8 +738,6 @@ void InitializationThread::selfTest(void)
|
||||
{
|
||||
const unsigned int cpu[7] = {CPU_TYPE_X86_GEN, CPU_TYPE_X86_SSE, CPU_TYPE_X86_AVX, CPU_TYPE_X64_GEN, CPU_TYPE_X64_SSE, CPU_TYPE_X64_AVX, 0 };
|
||||
|
||||
FileHash::selfTest();
|
||||
|
||||
for(size_t k = 0; cpu[k]; k++)
|
||||
{
|
||||
qDebug("[TEST]");
|
||||
|
Loading…
Reference in New Issue
Block a user