Delphi 2010 DCPCrypt2 Sha256 Hash doesn't equal PHP Hash
I'm writing a Delphi 2010 application that will connect to the PHP Web application to get specific data. Web page on the server accepts 3 **GET** parameters:

1. cityid   // Value needed for web application to return specific data
2. salt     // Current time stamp: Year Month Date Hour Minute Second Millisecond
3. token    // SHA-256 hash with security key for protection

The problem is with **token**. It's generated in Delphi using these functions:

    function DigestToStr(Digest: array of byte): string;
    var
      i: Integer;
    begin
      Result := '';
      for i := 0 to Length(Digest) do
        Result := Result + LowerCase(IntToHex(Digest[i], 2));
    end;

    function GetStringHash(Source: string): string;
    var
      Hash: TDCP_sha256;
      Digest: array[0..31] of Byte;
    begin
      Hash := TDCP_sha256.Create(nil);
      Hash.Init;
      Hash.UpdateStr(Source);
      Hash.Final(Digest);
      Hash.Free;
      Result := DigestToStr(Digest);
    end;
    
    procedure TMain.Button3Click(Sendere: TObject);
    var
      TheToken,Sha256:string;
    begin
      salt:=FormatDateTime('yyyymmddhhnnsszzz',Now);
      TheToken:=salt+'THE_SECRET_KEY'+MCity;
      Sha256:=GetStringHash(TheToken);
    end;
Delphi gives this string for a **token**: **ec4338bb3e7819a1148ffc01713f6d164f4f5940c5758d896b0a3d53f30f8c24f0**

PHP's **hash** function gives totally different string:

    <?php
      hash('sha256','20120119115458592THE_SECRET_KEY1');
    ?>
**8b4cff3b937bbcfae8fa7a67ce407b6185451a52e994ea2ef92a760676717490**

I tried to look for similar questions on the Web, but found only symmetric encryption/description problems discussed, I don't need symmetric encryption for the **token**
Delphi 2010 DCPCrypt2 Sha256 Hash doesn't equal PHP Hash
===

I'm writing a Delphi 2010 application that will connect to the PHP Web application to get specific data. Web page on the server accepts 3 **GET** parameters:

1. cityid   // Value needed for web application to return specific data
2. salt     // Current time stamp: Year Month Date Hour Minute Second Millisecond
3. token    // SHA-256 hash with security key for protection

The problem is with **token**. It's generated in Delphi using these functions:

    function DigestToStr(Digest: array of byte): string;
    var
      i: Integer;
    begin
      Result := '';
      for i := 0 to Length(Digest) do
        Result := Result + LowerCase(IntToHex(Digest[i], 2));
    end;

    function GetStringHash(Source: string): string;
    var
      Hash: TDCP_sha256;
      Digest: array[0..31] of Byte;
    begin
      Hash := TDCP_sha256.Create(nil);
      Hash.Init;
      Hash.UpdateStr(Source);
      Hash.Final(Digest);
      Hash.Free;
      Result := DigestToStr(Digest);
    end;
    
    procedure TMain.Button3Click(Sendere: TObject);
    var
      TheToken,Sha256:string;
    begin
      salt:=FormatDateTime('yyyymmddhhnnsszzz',Now);
      TheToken:=salt+'THE_SECRET_KEY'+MCity;
      Sha256:=GetStringHash(TheToken);
    end;
Delphi gives this string for a **token**: **ec4338bb3e7819a1148ffc01713f6d164f4f5940c5758d896b0a3d53f30f8c24f0**

PHP's **hash** function gives totally different string:

    <?php
      hash('sha256','20120119115458592THE_SECRET_KEY1');
    ?>
**8b4cff3b937bbcfae8fa7a67ce407b6185451a52e994ea2ef92a760676717490**

I tried to look for similar questions on the Web, but found only symmetric encryption/description problems discussed, I don't need symmetric encryption for the **token**