Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>My favourite answer - I would use the OpenSSL libraries, the HMAC function. I've successfully used the OpenSSL libraries in Delphi by adopting and adapting work from M Ferrante <a href="http://www.disi.unige.it/person/FerranteM/delphiopenssl/" rel="nofollow noreferrer">http://www.disi.unige.it/person/FerranteM/delphiopenssl/</a><br /> For other OpenSSL signing etc see <a href="https://stackoverflow.com/questions/1792541/convert-this-php-digital-signing-to-delphi/1808145#1808145">this link</a> <br/> In D2010 it's something like this (libeay32 is the unit taken from the web site and slightly modified for unicode/D2010):<br/></p> <pre><code>uses libeay32; const LIBEAY_DLL_NAME = 'libeay32.dll'; EVP_MAX_MD_SIZE = 64; function EVP_sha256: pEVP_MD; cdecl; external LIBEAY_DLL_NAME; function HMAC(evp: pEVP_MD; key: PByte; key_len: integer; data: PByte; data_len: integer; md: PByte; var md_len: integer): PByte; cdecl; external LIBEAY_DLL_NAME; function GetHMAC(const AKey, AData: string): TBytes; var key, data: TBytes; md_len: integer; res: PByte; begin OpenSSL_add_all_algorithms; // Seed the pseudo-random number generator // This should be something a little more "random"! RAND_load_file('c:\windows\paint.exe', 512); key := TEncoding.UTF8.GetBytes(AKey); data := TEncoding.UTF8.GetBytes(AData); md_len := EVP_MAX_MD_SIZE; SetLength(result, md_len); res := HMAC(EVP_sha256, @key[0], Length(key), @data[0], Length(data), @result[0], md_len); if (res &lt;&gt; nil) then begin SetLength(result, md_len); end; end; </code></pre> <p>Then call it with a key phrase and data string. The result is a TBytes which can be converted as required eg to Base64 using something like JclMime or a simple HexToString type function.<br/> For older version of Delphi you'll have to do a bit of changing of PBytes to PChars or something similar.<br/> Disclaimer: I've got no reference data to test this on but it seems to work ok!</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload