4D v13.4Generate digest |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
4D v13.4
Generate digest
Generate digest
The Generate digest command returns the digest key of a BLOB or text after application of an encryption algorithm. In 4D, two such algorithms are available: MD5 (Message Digest 5) and SHA-1 (Secure Hash 1). These algorithms are different hash functions:
The value returned for the same object is the same on all the platforms (Mac/Windows, 32 or 64 bits). The calculation is performed based on the representation in UTF-8 of the text passed in the parameter, regardless of the database operating mode (Unicode or ASCII compatibility). Note: If you use the command with an empty text/BLOB, it does not return void but returns the following value: "d41d8cd98f00b204e9800998ecf8427e" (MD5) or "da39a3ee5e6b4b0d3255bfef95601890afd80709" (SHA-1). Pass a Text or BLOB field or variable in the param parameter. The Generate digest function returns the digest key as a string. In the algorithm parameter, pass a value designating which hash function to use. Use one of the following constants, found in the Digest Type theme:
If the calculation of the digest key is not performed correctly, the function generates an error that you can intercept using the ON ERR CALL command and the function returns an empty string. This example compares two documents using the MD5 algorithm: PLATFORM PROPERTIES($Platf;$Syst;$vlMachine) These examples illustrate how to retrieve the digest key of a text: $key1:=Generate digest("The quick brown fox jumps over the lazy dog.";MD5 Digest) |
PROPERTIES
Product: 4D
INDEX HISTORY
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||