Hash.PBKDF2.HMAC
----------------

Returns the PBKDF2 hash value of the data, first applying the salt value and using the specified hashAlgorithm.

| Component | Version | macOS | Windows | Linux | Server | iOS SDK |
|---|---|---|---|---|---|---|
| [Hash](component_Hash.md) | [3.3](newinversion33.md) | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes |

MBS( "Hash.PBKDF2.HMAC"; salt; Password; iterations; desiredHashLength; hashAlgorithm { ; Flags } ) 

**MBS**( **"Hash.PBKDF2.HMAC";** /\* Returns the PBKDF2 hash value of the data, first applying the salt value and using the specified hashAlgorithm. \*/  
**$salt**; /\* The key text to use.e.g. "Hello" \*/   
**$Password**; /\* The data text to use.e.g. "World" \*/   
**$iterations**; /\* Number of loops that the hash algorithm does.e.g. 100 \*/   
**$desiredHashLength**; /\* Number of bytes that you want the resulting hash to be. 16 or 32 bytes are commonly used.e.g. 32 \*/   
**$hashAlgorithm**; /\* The hash algorithm. Can be MD5, SHA1, SHA256 or SHA512.e.g. "MD5" \*/   
**$Flags**) /\* Optional; Various flags you can combine by addition.  
Pass 1 for getting result Base64 encoded instead of Hex encoded.  
Pass 2 if salt is Hex encoded and plugin should decode it first.  
Pass 4 if password is hex encoded and plugin should decode it first.e.g. 0 \*/ 

### Parameters

| Parameter | Description | Example | Flags |
|---|---|---|---|
| salt | The key text to use. | "Hello" |  |
| Password | The data text to use. | "World" |  |
| iterations | Number of loops that the hash algorithm does. | 100 |  |
| desiredHashLength | Number of bytes that you want the resulting hash to be. 16 or 32 bytes are commonly used. | 32 |  |
| hashAlgorithm | The hash algorithm. Can be MD5, SHA1, SHA256 or SHA512. | "MD5" |  |
| Flags | Various flags you can combine by addition.   Pass 1 for getting result Base64 encoded instead of Hex encoded.   Pass 2 if salt is Hex encoded and plugin should decode it first.   Pass 4 if password is hex encoded and plugin should decode it first. | 0 | Optional |

### Result

Returns the hash or error.

### Description

Returns the PBKDF2 hash value of the data, first applying the salt value and using the specified hashAlgorithm.  
  
Same as Crypto.PBKDF2 in Xojo (Real Studio):  
<http://docs.realsoftware.com/index.php/Crypto.PBKDF2>  
### Examples

Calculate password hash:

 MBS ( "Hash.PBKDF2.HMAC"; "Hello"; "World"; 100; 32; "SHA512")  
<small>  
Example result: 2CFDC277C8B84693B85E18D5A0176249EF29B74DFFDF2EE6826636F5ACBF70D0</small>Use SHA-3 here:

 MBS ( "Hash.PBKDF2.HMAC"; "Hello"; "World"; 100; 32; "RSA-SHA3-256")  
### Release notes

- **Version 10.3**
    - Added option to [Hash.PBKDF2.HMAC](https://www.mbsplugins.eu/HashPBKDF2HMAC.shtml) to pass digest names returned by [Encryption.DigestNames](https://www.mbsplugins.eu/EncryptionDigestNames.shtml) function, so SHA3 works.

### Blog Entries

- [MBS FileMaker Plugin, version 10.3pr5](https://www.mbsplugins.de/archive/2020-06-20/MBS_FileMaker_Plugin_version_1/monkeybreadsoftware_blog_filemaker)
- [Comparing Base Elements Plugin to MBS FileMaker Plugin](https://www.mbsplugins.de/archive/2017-10-24/Comparing_Base_Elements_Plugin/monkeybreadsoftware_blog_filemaker)
- [MBS FileMaker Plugin, version 6.0pr7](https://www.mbsplugins.de/archive/2016-01-20/MBS_FileMaker_Plugin_version_6/monkeybreadsoftware_blog_filemaker)
- [MBS FileMaker Plugin 3.3 for OS X/Windows - More than 1600 Functions In One Plugin](https://www.mbsplugins.de/archive/2013-07-24/MBS_FileMaker_Plugin_33_for_OS/monkeybreadsoftware_blog_filemaker)
- [MBS Filemaker Plugin, version 3.3pr1](https://www.mbsplugins.de/archive/2013-05-24/MBS_Filemaker_Plugin_version_3/monkeybreadsoftware_blog_filemaker)

### FileMaker Magazin

- [Ausgabe 4/2013, Seite 37](https://filemaker-magazin.de/neuigkeit/3679-Appetithappen-FMM_201304)

This function checks for a license.

Created 18th August 2014 , last changed 19th June 2020

  
[Hash.MD5.HMAC](HashMD5HMAC.md) - [Hash.RandomHexString](HashRandomHexString.md)

[HTML Version](HashPBKDF2HMAC.shtml)