Topics   All   Mac OS X (Only)   Windows (Only)   Linux (Only, Not)   iOS (Only, Not)  
Components   Crossplatform Mac & Win   Server (Not)   Client   Old   Guides
New in version: 5.4   6.0   6.1   6.2   6.3   6.4   6.5   7.0   7.1   7.2    Statistic  

Hash.MD5

Calculated MD5 hash of given text.

Component: Hash
Version: 2.7
Mac OS X: Yes
Windows: Yes
Server: Yes
FileMaker Cloud: Yes

MBS( "Hash.MD5"; text { ; Flags } )

Parameters

Parameter Description Example value
text The text to process. "Hello World"
Flags Optional
Various flags you can combine by addition.
Pass 1 for getting result Base64 encoded instead of Hex encoded.
Pass 2 if input data is Hex encoded and plugin should decode it first.
0

Result

Returns MD5 hash.

Description

Calculated MD5 hash of given text.
Text is converted to UTF-8 to make sure the text encoding doesn't change the hash value.
Hashes are used to store a fingerprint of some data. When hashes are not equal, the data is probably also not equal.
This function is good to make hashes for passwords. You don't save the password in your database, but only the hash. On login, you calculate the hash for the password entered by the user and compare the hash with the stored one. This way the database only contains hashes. And it's unlikely someone finds the password given the hash, except for easy cases like "hello" where google will tell you the text for the hash.
To make hashes more secure, use a prefix/suffix like the user id or simply your application name. This way even hello as a password will be quite impossible to recover from the hash.
SHA-512 is stronger than MD5.

Please be aware that text can result in different hashes if it contains line endings. You may want to make sure that line endings are right with the Text.ReplaceNewline function before you compare hashes to results in other development tools. FileMaker uses Mac line endings by default and most examples for Javascript use Unix line endings.

Examples

Calculate hash of password:

MBS( "Hash.MD5"; $password )

Testing flags:

Set Variable [$hash1; Value:MBS( "Hash.MD5"; "Hello" )]
Set Variable [$hash2; Value:MBS( "Hash.MD5"; "48656C6C6F"; 2 )]
Show Custom Dialog ["Two calculations for same hash…"; $hash1 & ¶ & $hash2]

See also


Hash.Digest   -   Hash.MD5.HMAC

Feedback: Report problem or ask question.




Links
MBS Real Studio Chart Plugins - Pfarrgemeinde Messdiener Nickenich