Skip to content

Commit

Permalink
v2.8.4 Fixes to Expected Hash Value and reversal of pointers addition…
Browse files Browse the repository at this point in the history
…s in Text field
  • Loading branch information
tedsmith committed Aug 28, 2017
1 parent bfc7343 commit eb4b698
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 30 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
Version History
===============

V2.8.4
------
The "Expected Hash Value" field had been broke a little in the 2.8.3 release meaning that when the user first pasted a value, it would report a mis-match even when it matched. But if the user re-pasted the value, it would match as intended (https://quickhash-gui.org/bugs/expected-hash-value-report-wrongly-on-single-file-hashing/). That fault was fixed.
The "Expected Hash Value" was comparing only 7 characters instead of 8 for xxHash. That was fixed.
The date and time formatting that was reported as fixed in v2.8.3 was not as fixed as it should be, and also was not included in the Linux version as it should have been.
The "Text" field had been accidentally adjusted to use pointers to widestrings. The commit was accepted without realisng the impact. So 'hello' was not being hashed but it's Unicode widestring version was being hashed. That was fixed and reverted to it's previous settings.

v2.8.3
------

Expand Down
2 changes: 1 addition & 1 deletion diskmodule.lfm
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ object frmDiskHashingModule: TfrmDiskHashingModule
Height = 623
Top = 363
Width = 787
Caption = 'QuickHash v2.8.3 - Disk Hashing Module'
Caption = 'QuickHash v2.8.4 - Disk Hashing Module'
ClientHeight = 623
ClientWidth = 787
DefaultMonitor = dmDesktop
Expand Down
2 changes: 1 addition & 1 deletion project1.lpr
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
{$R *.res}

begin
Application.Title:='QuickHash';
Application.Title:='Quick Hash';

This comment has been minimized.

Copy link
@darealshinji

darealshinji Aug 28, 2017

Collaborator

Shouldn't the title be "QuickHash"?

This comment has been minimized.

Copy link
@tedsmith

tedsmith via email Aug 28, 2017

Author Owner
Application.Initialize;
Application.CreateForm(TMainForm, MainForm);
Application.CreateForm(TfrmDisplayGrid1, frmDisplayGrid1);
Expand Down
7 changes: 4 additions & 3 deletions unit2.lfm
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ object MainForm: TMainForm
Top = 73
Width = 1018
AllowDropFiles = True
Caption = 'QuickHash v2.8.3 - The easy and convenient way to hash data in Linux, OSX and Windows'
Caption = 'QuickHash v2.8.4 - The easy and convenient way to hash data in Linux, OSX and Windows'
ClientHeight = 695
ClientWidth = 1018
Menu = MainMenu1
Expand All @@ -18,11 +18,11 @@ object MainForm: TMainForm
Height = 657
Top = 24
Width = 986
ActivePage = TabSheet4
ActivePage = TabSheet1
Anchors = [akTop, akLeft, akRight, akBottom]
ParentShowHint = False
ShowHint = True
TabIndex = 3
TabIndex = 0
TabOrder = 0
OnChange = PageControl1Change
object TabSheet1: TTabSheet
Expand Down Expand Up @@ -314,6 +314,7 @@ object MainForm: TMainForm
'Computed hash will appear here...'
)
TabOrder = 3
WordWrap = False
end
object lbleExpectedHash: TLabeledEdit
Left = 6
Expand Down
38 changes: 13 additions & 25 deletions unit2.pas
Original file line number Diff line number Diff line change
Expand Up @@ -874,7 +874,7 @@ procedure TMainForm.HashText(Sender: TObject);
end
else
begin
strHashValueText := Trim(Uppercase(CalcTheHashString(memoHashText.Text)));
strHashValueText := Uppercase(Trim(CalcTheHashString(memoHashText.Text)));
StrHashValue.Caption := strHashValueText;
if (lbleExpectedHash.Text = '') then exit
else
Expand Down Expand Up @@ -953,23 +953,13 @@ procedure TMainForm.btnHashFileClick(Sender: TObject);

stop := Now;
elapsed := stop - start;
lbEndedFileAt.Caption := 'Ended at : '+ DateTimeToStr(stop);
lblFileTimeTaken.Caption := 'Time taken : '+ TimeToStr(elapsed);
lbEndedFileAt.Caption := 'Ended at : ' + FormatDateTime('DD/MM/YYYY HH:MM:SS', stop);
lblFileTimeTaken.Caption := 'Time taken : ' + FormatDateTime('HH:MM:SS', elapsed);
Application.ProcessMessages;

// If the user has ane existing hash to check, compare it here
if (lbleExpectedHash.Text = '') then exit
else
if (lbleExpectedHash.Text = '...') then exit
else
if fileHashValue = Trim(Uppercase(lbleExpectedHashText.Text)) then
begin
Showmessage('Expected hash matches the generated text hash, OK');
end
else
begin
Showmessage('Expected hash DOES NOT match the generated text hash!');
end;
// If the user has ane existing hash to check in expected hash value field,
// compare it here
lbleExpectedHashChange(Sender);
end
else
ShowMessage('An error occured opening the file. Error code: ' + SysErrorMessageUTF8(GetLastOSError));
Expand Down Expand Up @@ -1152,7 +1142,7 @@ procedure TMainForm.lbleExpectedHashChange(Sender: TObject);
exit
else if (Length(trim(lbleExpectedHash.Text)) = 32) or (Length(trim(lbleExpectedHash.Text)) = 40)
or (Length(trim(lbleExpectedHash.Text)) = 64) or (Length(trim(lbleExpectedHash.Text)) = 128)
or (Length(trim(lbleExpectedHash.Text)) = 7) then
or (Length(trim(lbleExpectedHash.Text)) = 8) then
begin
if Uppercase(memFileHashField.Lines[0]) = Trim(Uppercase(lbleExpectedHash.Text)) then
begin
Expand Down Expand Up @@ -3080,10 +3070,8 @@ function TMainForm.ValidateTextWithHash(strToBeHashed:ansistring) : string;
function TMainForm.CalcTheHashString(strToBeHashed:ansistring):string;
var
TabRadioGroup1: TRadioGroup;
_strToBeHashed: UnicodeString;
begin
TabRadioGroup1 := AlgorithmChoiceRadioBox1;
_strToBeHashed := PWideChar(strToBeHashed);
result := '';
if Length(strToBeHashed) > 0 then
begin
Expand All @@ -3097,22 +3085,22 @@ function TMainForm.CalcTheHashString(strToBeHashed:ansistring):string;

case TabRadioGroup1.ItemIndex of
0: begin
result := THashFactory.TCrypto.CreateMD5().ComputeString(_strToBeHashed, TEncoding.UTF8).ToString();
result := THashFactory.TCrypto.CreateMD5().ComputeString(strToBeHashed, TEncoding.UTF8).ToString();
end;
1: begin
result := THashFactory.TCrypto.CreateSHA1().ComputeString(_strToBeHashed, TEncoding.UTF8).ToString();
result := THashFactory.TCrypto.CreateSHA1().ComputeString(strToBeHashed, TEncoding.UTF8).ToString();
end;
2: begin
result := THashFactory.TCrypto.CreateSHA2_256().ComputeString(_strToBeHashed, TEncoding.UTF8).ToString();
result := THashFactory.TCrypto.CreateSHA2_256().ComputeString(strToBeHashed, TEncoding.UTF8).ToString();
end;
3: begin
result := THashFactory.TCrypto.CreateSHA2_512().ComputeString(_strToBeHashed, TEncoding.UTF8).ToString();
result := THashFactory.TCrypto.CreateSHA2_512().ComputeString(strToBeHashed, TEncoding.UTF8).ToString();
end;
4: begin
{$ifdef CPU64}
result := THashFactory.THash64.CreateXXHash64().ComputeString(_strToBeHashed, TEncoding.UTF8).ToString();
result := THashFactory.THash64.CreateXXHash64().ComputeString(strToBeHashed, TEncoding.UTF8).ToString();
{$else if CPU32}
result := THashFactory.THash32.CreateXXHash32().ComputeString(_strToBeHashed, TEncoding.UTF8).ToString();
result := THashFactory.THash32.CreateXXHash32().ComputeString(strToBeHashed, TEncoding.UTF8).ToString();
{$endif}
end;
end;
Expand Down

0 comments on commit eb4b698

Please sign in to comment.