1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | //--------------------------------------------------------------------------- #include //--------------------------------------------------------------------------- UnicodeString __fastcall TForm1::GetSHA1ChecksumFromFile( const UnicodeString PathFile){ UnicodeString ret; TFileStream *FileStream = NULL; TIdHashSHA1 *SHA1 = NULL; try { FileStream = new TFileStream(PathFile, fmOpenRead | fmShareDenyWrite); SHA1 = new TIdHashSHA1(); ret = SHA1->HashStreamAsHex(FileStream); SHA1->Free(); FileStream->Free(); } catch (...) { SHA1->Free(); FileStream->Free(); } return ret; } //--------------------------------------------------------------------------- |