Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 5 of 5 total
Thread Problem with ComputeHash in data module
Mon, Aug 7 2017 9:25 AMPermanent Link

Paul Coshott

Avatar

Hi All,

I am writing a data server module to allow the users to change their password. I am sending the UserId, old password and new password.
I am using ComputeHash on both passwords, but for some reason, only the first one works. The second one is always blank.

This is the code:
         TempOldPassword := TempContent.Values['OldPassword'];
         TempOldPasswordHash := ComputeHash(htSHA256,UTF8Encode(TempOldPassword));
         TempNewPassword := TempContent.Values['NewPassword'];
         TempNewPasswordHash := ComputeHash(htSHA256,UTF8Encode(TempNewPassword));

As the code stands, the TempOldPasswordHash variable is filled correctly, but the TempNewPasswordHash is blank.

If I move the New password lines before the old password lines, the variable TempNewPasswordHash is filled correctly, and the TempOldPasswordHash is blank.

Am I doing something wrong? All variables are defined as strings.

Thanks for any suggestions.

Cheers,
Paul
Fri, Aug 11 2017 2:34 PMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Paul,

<< I am writing a data server module to allow the users to change their password. I am sending the UserId, old password and new password.  I am using ComputeHash on both passwords, but for some reason, only the first one works. The second one is always blank.

Sorry that I missed this post.  I'm checking it out and will post the results shortly.

Tim Young
Elevate Software
www.elevatesoft.com
Thu, Aug 31 2017 1:27 PMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Paul,

Sorry for taking so long to look into this..

I ran your code here in a straight desktop application (in order to isolate the code) and I'm not seeing any issues - both password hashes are computed properly.

How are you determining that the second hash isn't being computed properly ?  Are you stepping through the module in the debugger ?

Thanks,

Tim Young
Elevate Software
www.elevatesoft.com
Thu, Aug 31 2017 9:34 PMPermanent Link

Paul Coshott

Avatar

Hi Tim,

<< How are you determining that the second hash isn't being computed properly ?  Are you stepping through the module in the debugger ?

I was looking in the database after they had been saved. Which ever password was first in the code (ie the TempOldPassword, or the TempNewPassword), that password would calculated correctly, and the other would be completely blank.

Cheers,
Paul
Fri, Sep 1 2017 6:27 AMPermanent Link

Uli Becker

Paul,

> I was looking in the database after they had been saved. Which ever password was first in the code (ie the TempOldPassword, or the TempNewPassword), that password would calculated correctly, and the other would be completely blank.

As Tim already suggested: you should step through the module and check
out what happens there first.

To do so: just use Start | Parameter | Host Application in the Delphi
project.

Enter either EWBSrvr.exe or the IDE-exe there.

Then you can set breakpoints and/or use MessageBoxes in the code.
Running the module will start the host application and let you check out
the problem.

Uli
Image