Use Qt cryptographic library instead of C implementation (regression on win32)
This commit is contained in:
@@ -19,7 +19,6 @@
|
||||
|
||||
#include <fstream>
|
||||
#include <iostream>
|
||||
#include <sha1.h>
|
||||
|
||||
#include <QString>
|
||||
#include <QMessageBox>
|
||||
@@ -27,6 +26,7 @@
|
||||
#include <QSqlError>
|
||||
#include <QVariant>
|
||||
#include <QSqlRecord>
|
||||
#include <QCryptographicHash>
|
||||
|
||||
#include "Database.hpp"
|
||||
|
||||
@@ -151,22 +151,7 @@ void Database::CreateDatabase()
|
||||
|
||||
QString Database::HashPassword(const QString& password)
|
||||
{
|
||||
blk_SHA_CTX sha_ctx;
|
||||
unsigned char sha[20];
|
||||
QString res;
|
||||
|
||||
blk_SHA1_Init(&sha_ctx);
|
||||
blk_SHA1_Update(&sha_ctx, password.toStdString().c_str(), password.size());
|
||||
blk_SHA1_Final(sha, &sha_ctx);
|
||||
|
||||
for(int i=0; i<20; i++)
|
||||
{
|
||||
if (((int)sha[i]) <= 16)
|
||||
res += "0" ;
|
||||
res += QString::number((int)sha[i], 16);
|
||||
}
|
||||
|
||||
return res;
|
||||
return QCryptographicHash::hash(password.toUtf8(), QCryptographicHash::Sha1).toHex();
|
||||
}
|
||||
|
||||
std::list<QString> Database::GetUsers()
|
||||
|
||||
Reference in New Issue
Block a user