Topics
All
MacOS
(Only)
Windows
(Only)
Linux
(Only, Not)
iOS
(Only, Not)
Components
Crossplatform Mac & Win
Server
Client
Old
Deprecated
Guides
Examples
Videos
New in version:
9.5
10.0
10.1
10.2
10.3
10.4
10.5
11.0
11.1
11.2
Statistic
FMM
Blog
Calculates a hash of a value.
Component | Version | macOS | Windows | Linux | Server | iOS SDK |
Hash | 4.1 | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes |
Parameter | Description | Example | Flags |
---|---|---|---|
Algorithm | Which algorithm to use. Can be MD4, MD5, SHA, SHA1, MDC2, RIPEMD160, SHA224, SHA256, SHA384 or SHA512. |
"SHA512" | |
InputType | The type of input. Can be Text, Container, Image, Path, PDF, Data, base64 or Hex. |
"Text" | |
InputData | The actual input data. Text, container or file path. |
"Hello World" | |
InputEncoding | The text encoding for text input. Parameter is ignored for other cases. Possible encoding names: ANSI, ISO-8859-1, Latin1, Mac, Native, UTF-8, DOS, Hex, Base64 or Windows. More listed in the FAQ. |
"UTF-8" | |
OutputType | The output type. Can be Base64, Hex, Text, File, Path. Added Base64URL as option for plugin version 10.3. |
"Hex" | |
OutputInfo | The addition info for output. For text it is the text encoding, for file container the file name and for path the actual native file path. |
"" | Optional |
Returns error or hash.
Calculate MD5 from text:
MBS( "Hash.Digest"; "MD5"; "Text"; "Hello World"; "UTF-8"; "Hex"; "" )
Calculate SHA512 from image in container and encode it as base64:
MBS( "Hash.Digest"; "SHA512"; "Image"; MyTable::MyContainer; ""; "Base64"; "" )
Hash of PDF in container:
MBS( "Hash.Digest"; "SHA512"; "PDF"; MyTable::MyContainer; ""; "Hex"; "" )
Hash a file with MD5:
MBS( "Hash.Digest"; "MD5"; "Path"; "/Users/cs/Desktop/test.fmp12"; ""; "Hex"; "" )
Stream file to AWS:
# Build a path to file (local) and in AWS
Set Variable [ $Filename ; Value: "test.pdf" ]
Set Variable [ $Path ; Value: "/" & $BucketName & "/PDF/" & $Filename ]
Set Variable [ $localPath ; Value: "/Users/cs/Desktop/license.pdf" ]
# calculate hash for file to upload
Set Variable [ $HashedPayload ; Value: Lower(MBS( "Hash.Digest"; "sha256"; "path"; $localPath; ""; "hex" )) ]
# upload
Set Variable [ $curl ; Value: MBS("CURL.New") ]
# file content is streamed
Set Variable [ $result ; Value: MBS("CURL.OpenInputFile"; $curl; $localPath) ]
# setup AWS
Set Variable [ $result ; Value: MBS("CURL.SetupAWS"; $curl; $AWSAccessKeyId; $AWSSecretAccessKey; $Region; $Service; $Path; $Domain; $Verb; $HashedPayload; $headers) ]
Set Field [ CURL Test::Result ; MBS("CURL.Perform"; $curl) ]
Set Field [ CURL Test::debug ; MBS("CURL.GetDebugAsText"; $curl) ]
Set Variable [ $result ; Value: MBS("CURL.Release"; $curl) ]
Use SHA-3:
MBS( "Hash.Digest"; "RSA-SHA3-256"; "Text"; "Hello World"; "UTF-8"; "Hex"; "" )
Example result: E167F68D6563D75BB25F3AA49C29EF612D41352DC00606DE7CBD630BB2665F51
Created 18th August 2014, last changed 19th June 2020
Feedback: Report problem or ask question.