EldoS | Feel safer!

Software components for data protection, secure storage and transfer

PKIBlackbox and IntraWeb

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:

  HashC: TElHashFunction;
  InBuf : array[0..32767] of byte;
  iCounter: Integer;
  s: String;
  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;

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

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

Sincerely yours
Eugene Mayevski
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.
Posted: 06/02/2008 06:02:38
by Ken Ivanov (Team)

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.



Topic viewed 1640 times

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


Back to top

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

Got it!