Topics   All   Mac OS X (Only)   Windows (Only)   Linux (Only, Not)   iOS (Only, Not)  
Components   Crossplatform Mac & Win   Server   Client   Old   Guides   Examples
New in version: 7.0   7.1   7.2   7.3   7.4   7.5   8.0   8.1   8.2   8.3    Statistic  

Hash.SHA512.HMAC

Returns the a SHA512 HMAC based on the key and the data string.

Component Version macOS Windows Server FileMaker Cloud FileMaker iOS SDK
Hash 4.0 Yes Yes Yes Yes Yes

MBS( "Hash.SHA512.HMAC"; key; data { ; Flags } )

Parameters

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

Result

Returns the hash string.

Description

Returns the a SHA512 HMAC based on the key and the data string.
Keyed-Hash Message Authentication Code is a way to add salt to a hash for more security.

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

Hash empty string

MBS( "Hash.SHA512.HMAC"; ""; "" )

Example result: B936CEE86C9F87AA5D3C6F2E84CB5A4239A5FE50480A6EC66B70AB5B1F4AC6730C6C515421B327EC1D69402E53DFB49AD7381EB067B338FD7B0CB22247225D47

Hash a test string

MBS( "Hash.SHA512.HMAC"; "key"; "The quick brown fox jumps over the lazy dog")

Example result: B42AF09057BAC1E2D41708E48A902E09B5FF7F12AB428A4FE86653C73DD248FB82F948A549F7B791A5B41915EE4D1EC3935357E4E2317250D0372AFA2EBEEB3A

FileMaker 16 vs. Plugin:

# MBS Plugin:
MBS( "Hash.SHA512.HMAC"; "Key"; "Data")
# Same via FileMaker 16 native:
HexEncode( CryptAuthCode ( "Data" ; "SHA512" ; "Key" ))

See also


Hash.SHA512   -   HealthKit.AuthorizationStatusForType

Feedback: Report problem or ask question.




Links
MBS Xojo Chart Plugins