procedure TTestgoDecUnitHashes.TestHashHEX;
var
strResultV3: ANSIString;
strResultV5: ANSIString;
cResult: Cardinal;
begin
// FText (:ANSIString) := 'This is a confidential ANSI Text';
strResultV3 := '
03BEBC72';
//Hash.THash_CRC32.CalcString(FText, nil, fmtHEX);
cResult := DEC5_CRC.CRCCalc(CRC_32CCITT, PAnsiChar(FText)^, Length(FText));
strResultV5 := DEC5_DECFmt.TFormat_HEX.Encode(cResult, 4);
CheckEqualsString(strResultV3, strResultV5);
end;
procedure TTestgoDecUnitHashes.TestHashHEX_new;
var
strResultV3: ANSIString;
strResultV5: ANSIString;
cResult: Cardinal;
objCRCDef: DEC5_CRC.TCRCDef;
strKey: ANSIString;
cVector: Cardinal;
begin
// FText (:ANSIString) := 'This is a confidential ANSI Text';
strResultV3 := '
03BEBC72';
//Hash.THash_CRC32.CalcString(FText, nil, fmtHEX);
DEC5_CRC.CRCSetup(objCRCDef, $04C11DB7, 32, $FFFFFFFF, $FFFFFFFF, True);
DEC5_CRC.CRCCode(objCRCDef, PAnsiCHar(FText)^, Length(FText));
cResult := DEC5_CRC.CRCDone(objCRCDef);
strResultV5 := DEC5_DECFmt.TFormat_HEX.Encode(cResult, 4);
CheckEqualsString(strResultV3, strResultV5);
end;