[saco] Implement SHA1_HashData(...)

This commit is contained in:
RD42 2024-02-21 19:16:31 +08:00
parent 824e446786
commit aeda9835f3
3 changed files with 37 additions and 0 deletions

23
saco/checksums.cpp Normal file
View File

@ -0,0 +1,23 @@
#include <stdio.h>
#include <windows.h>
#include "fhicl-sha1.h"
//----------------------------------------------------------
void SHA1_HashData(PCHAR szData, DWORD dwLen, DWORD *pdwDigest)
{
fhicl::SHA1 sha1;
for(int i = 0; i < 5; i++) {
pdwDigest[i] = 0;
}
if(!IsBadReadPtr(szData, dwLen))
{
sha1.Input(szData, dwLen);
sha1.Result((unsigned int*)pdwDigest);
}
}
//----------------------------------------------------------

8
saco/checksums.h Normal file
View File

@ -0,0 +1,8 @@
#pragma once
//----------------------------------------------------------
void SHA1_HashData(PCHAR szData, DWORD dwLen, DWORD *pdwDigest);
//----------------------------------------------------------

View File

@ -544,6 +544,12 @@
<File
RelativePath=".\chatwindow.h">
</File>
<File
RelativePath=".\checksums.cpp">
</File>
<File
RelativePath=".\checksums.h">
</File>
<File
RelativePath=".\cmdprocs.cpp">
</File>