4D v14.3Generate digest |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
4D v14.3
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, the following algorithms are available: MD5 (Message Digest 5), SHA-1 (Secure Hash 1) and 4D (internal algorithm). 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. 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) This example only accepts the "admin" user with the password "123" that does not match a 4D user: |
PROPERTIES
Product: 4D
HISTORY
ARTICLE USAGE
4D Language Reference ( 4D v14 R2) Inherited from : Generate digest ( 4D v13.5) |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||