Crypto.PBKDF2
From Xojo Documentation
New in 2019r3.1
Supported for all project types and targets.
Returns the PBKDF2 hash value of the data, first applying the salt value and using the specified hashAlgorithm. The iteration parameter is the number of loops that the hash algorithm does. The desiredHashLength parameter lets you specify the number of bytes that you want the resulting hash to be. 16 or 32 bytes are commonly used.
This item was deprecated in version 2019r3.1. Please use PBKDF2 from above as a replacement. |
New in 2012r2
Supported for all project types and targets.
Returns the PBKDF2 hash value of the data, first applying the salt value and using the specified hashAlgorithm. The iteration parameter is the number of loops that the hash algorithm does. The desiredHashLength parameter lets you specify the number of bytes that you want the resulting hash to be. 16 or 32 bytes are commonly used.
Notes
PBKDF2 is a "slow", i.e. deliberately processing intensive, algorithm for generating hash values. Slow is relative, for generating a single hash value it is plenty fast. The benefit of a slow algorithm is that it is impractical for hackers to generate hash tables using it because it would take too long to generate the thousands of hashes for commonly used values.
Use a higher value for iterations' to further slow the hash creation.
Refer to PBKDF2 on Wikipedia.
Use the Crypto.HashAlgorithms enumeration with the Hash method to specify the type of hash. It has these values:
- MD5
- SHA1
- SHA256
- SHA512
Sample Code
This example generates a 32-byte hash using PBKDF2 for the salt and data, iterating 100 times: