EldoS | Feel safer!

Software components for data protection, secure storage and transfer

PKIBlackbox and IntraWeb

Also by EldoS: CallbackRegistry
A component to monitor and control Windows registry access and create virtual registry keys.
#6457
Posted: 06/02/2008 04:10:52
by Mohammad Khorsandi (Basic support level)
Joined: 05/05/2008
Posts: 34

I have written a simple web application with Delphi 2007 and IntraWeb that includes IWEdit and IWButton, and I have use TELHashFunction class in my web app. When I executed Update and then Finish functions to take Hash string the result is nothing for some Strings, for example: 12345678

this is my code:

Code
var
  HashC: TElHashFunction;
  InBuf : array[0..32767] of byte;
  iCounter: Integer;
  s: String;
begin
  for iCounter := 0 to 32767 do
    InBuf[iCounter] := 0;

  s := IWEdit1.Text;

  for iCounter := 1 to Length(s) do
    InBuf[iCounter - 1] := ord(s[iCounter]); //-48

  HashC := TElHashFunction.Create(SB_ALGORITHM_DGST_MD5);

  HashC.Update(@InBuf, Length(InBuf));
  IWEdit2.Text := HashC.Finish;
  FreeAndNil(HashC);
end;


Is there any mistake to handle Byte and String variables in my web app?
#6458
Posted: 06/02/2008 04:59:39
by Eugene Mayevski (EldoS Corp.)

Have you set the license key? If no, then you won't get correct results.


Sincerely yours
Eugene Mayevski
#6459
Posted: 06/02/2008 05:37:05
by Mohammad Khorsandi (Basic support level)
Joined: 05/05/2008
Posts: 34

Yes, I have.
This functions results is correct in Windows Application but in Web application is incorrect.
#6460
Posted: 06/02/2008 06:02:38
by Ken Ivanov (EldoS Corp.)

The result of TElHashFunction.Finish() method is a binary string. Please use some binary conversion routines to convert it to a printable string.

SBUtils unit contains BinaryToString method that can be used for such a purpose.

Reply

Statistics

Topic viewed 1423 times

Number of guests: 1, registered members: 0, in total hidden: 0




|

Back to top

As of July 15, 2016 EldoS Corporation will operate as a division of /n software inc. For more information, please read the announcement.

Got it!