Generates a MD5 or SHA digest.
Encr_MakeDigest ( switches ; text )
|switches||determines the behavior of the function|
|text||the text to calculate the digest of|
Switches can be one of this:
|-md5||use the MD5 algorithm|
|-sha1||use the SHA-1 algorithm|
|-sha256||use the SHA-256 algorithm|
You can also add one or more of the switches below:
|-hex||(default) output as a hex dump. This is the default for a "normal" digest as opposed to a digital signature.|
|-colons||add colons between the result|
|-Encoding=UTF8||this will encode higher Unicode to UTF8 first, before calculating the digest. This is useful for for example Russian or Chinese texts.|
|-DigestCompatibleWithv30||generate the (incorrect) digests of v3.0, which only differ for digests of text bigger than 32000 characters.|
Data type returned
the digest, which is a string of bits.
MD5: a digest of 128 bits, formatted as 32 characters
SHA-1: a digest of 160 bits, formatted as 40 characters
SHA-256: a digest of 256 bits, formatted as 64 characters
The characters are all lower ASCII and therefore safe to send across internet.
Troi Encryptor Plug-in 1.2
FileMaker Pro 15 to 19
Troi Encryptor Plug-in 6.0 adds the new switch -SHA256
What is MD5, SHA-1 and SHA256?
MD5: MD5 was developed by Prof. Rivest in 1994. Its 128 bit (16 characters) message digest makes it a faster implementation than SHA-1, but is no longer considered safe.
SHA-1 + SHA256 : The Secure Hash Algorithm (SHA) was developed by NIST and is specified in the Secure Hash Standard (SHS, FIPS 180). SHA-1 produces a 160-bit (20 bytes) message digest. SHA256 even has 256 bits (or 32 bytes) length. This larger digest size makes it stronger against brute force attacks.
Note that MD5 is no longer considered collision-free/unique. If possible use SHA-1. You can find more info on this here:
Please note that we fixed a bug in v3.0.1 which was introduced in v3.0: when creating a MD5 digest an incorrect digest would be returned for texts bigger than 32000 characters. We have added a switch “-DigestsCompatibleWithv30” so you can generate the (incorrect) digests of v3.0 if needed.
Encr_MakeDigest ( "-md5" ; "Here is a sample text that you can see the digest of." )
gives this result: “937ddb8fcd1c7d947aa3bb66789e82e8”
If you add the “-colons” switch, the result is:
If you use “-sha1” as switch, the result is:
If you use “-sha1 -colons” as switches, the result is:
You can use this function to check if (the meaning of) a text was not changed, by adding the signature to the message.
Send Message [ message & "¶MD5 Digest = " & Encr_MakeDigest ( "-md5" ; message ) ]
At the receiving end you need these fields:
signaturePos = Position (messageReceived ; "¶MD5 Digest = " ; 1 ; 1 ) messageClean = Left (messageReceived ; signaturePos ) signatureReceived = Middle ( messageReceived ; signaturePos + 12 ; Length ( messageReceived ) ) messageOK = Encr_MakeDigest ( "-md5" ; messageClean ) = signatureReceived