FSN#37847 Versie 4.16 met fixje voor hash van niet bestaande files

svn path=/Slnkdwf/trunk/; revision=30883
This commit is contained in:
Jos Groot Lipman
2016-09-27 15:23:29 +00:00
parent 9036cf74af
commit f38f6a3b93
3 changed files with 9 additions and 5 deletions

View File

@@ -297,7 +297,7 @@ STDMETHODIMP CCrypto::hex_pbkdf2(BSTR pPassword, BSTR pSalt, ULONG pCount, ULONG
}
#define SHA1_MAX_FILE_BUFFER (32 * 20 * 820)
std::string HashFile(const TCHAR* tszFileName)
bool HashFile(const TCHAR* tszFileName, std::string &result)
{
if (tszFileName == NULL) return false;
@@ -327,13 +327,14 @@ std::string HashFile(const TCHAR* tszFileName)
fclose(fpIn);
delete[] pbData;
return sha1.getHash();
result = sha1.getHash();
return bSuccess;
}
STDMETHODIMP CCrypto::hex_sha1_file(BSTR fname, BSTR* pVal)
{
std::string res = HashFile(CString(fname)); // Hash the contents of the file
if (res.empty())
std::string res;
if (!HashFile(CString(fname), res)) // Hash the contents of the file
return myAtlReportError (GetObjectCLSID(), "\nCCrypto::hex_sha1_file('%ls')", (LPCSTR)fname);
CComBSTR bstrString(res.c_str());

View File

@@ -1,6 +1,6 @@
// Zorg dat versies alfabetisch altijd op elkaar volgen!
#define SLNK_MAJOR_VERSION 4
#define SLNK_MINOR_VERSION 15
#define SLNK_MINOR_VERSION 16
#define SLNK_BUILD_VERSION 0
// Define resource strings

View File

@@ -1,3 +1,6 @@
V4.16 27-09-2016
- hex_sha1_file van niet bestaande files leidde tot Access denied
V4.15 06-09-2016
- Crypto hex_hmac_sha256 toegevoegd
- hex2base64 en base64 functie toegevoegd