Menu

CRC32 Checksum

2024-07-27 - Kryptografia
//---------------------------------------------------------------------------
#include 
//---------------------------------------------------------------------------
UnicodeString __fastcall TForm1::GetCRC32ChecksumFromFile(const UnicodeString PathFile){
 
    UnicodeString ret;
    TFileStream *FileStream = NULL;
    TIdHashCRC32 *CRC32 = NULL;
    try {
        FileStream = new TFileStream(PathFile, fmOpenRead | fmShareDenyWrite);
        CRC32 = new TIdHashCRC32();
        ret = CRC32->HashStreamAsHex(FileStream);
 
        CRC32->Free();
        FileStream->Free();
    } catch (...) {
        CRC32->Free();
        FileStream->Free();
    }
    return ret;
}
//---------------------------------------------------------------------------