Converts a string into a fixed length hexadecimal string.
NOTE: The result is useful for comparison and validation, such as storing and validating a hashed password without exposing the original password.
hash(string [, algorithm [, encoding]] [, additionalIterations])
→ returns string
MD5
CFMX_COMPAT
MD5
SHA
SHA-256
SHA-384
SHA-512
UTF-8
defaultCharset
in the neo-runtime.xml
file, which is normally UTF-8
. CFMX_COMPAT
algorithm.
utf-8
iso-8859-1
windows-1252
us-ascii
shift_jis
iso-2022-jp
euc-jp
euc-kr
big5
euc-cn
utf-16
0
CFMX_COMPAT
default algorithm is used.
additionalIterations
as the iterations param.
numIterations
.
Returns 64 character hex result.
hash("something", "SHA-256", "UTF-8")
Expected Result: 3FC9B689459D738F8C88A3A48AA9E33542016B7A4052E001AAA536FCA74813CB
MD5 is not recommended for use requiring security.
hash("something")
Expected Result: 437B930DB84B8079C2DD804A71936B5F
Signup for cfbreak
to stay updated on the latest news from the ColdFusion / CFML community. One email, every friday.