This function compares a plaintext entry to the hashed string.
NOTE 1:Hashing is one-way, so you can't "decrypt" a hashed value. You have to hash the value you want to check and then compare that to the saved hash.
NOTE 2: The version and rounds don't need to be specified because they are included at the beginning of the hashed string.

verifyBCryptHash(plaintext,hashedstring); → returns boolean

This function requires Adobe ColdFusion 2021 and up.  Not supported on Lucee, etc.

Argument Reference

plaintext string

The unhashed string to compare.

hashedstring string

The hashed string to compare.

Links more information about verifyBCryptHash

Sample code invoking the verifyBCryptHash function

This is an example of using the function to check against a hashed value.

checkMe="My voice is my passport. Verify me."

Expected Result: YES

This is an example of using the function to check against a hashed value when the options were previously set.

checkMe="Setec Astronomy"

Expected Result: YES

Signup for cfbreak to stay updated on the latest news from the ColdFusion / CFML community. One email, every friday.

Fork me on GitHub