Name
Hash — New as of ColdFusion 4.5
Synopsis
Hash(string
)
One-way encrypts string
using the MD5 hash
algorithm. The resulting string is a 32-character hexidecimal
representation of the original string. Because the MD5 algorithm is a
one-way hash, there is no way to decrypt the encrypted string. The
Hash( )
function is often used to hash passwords
before storing them in a database. This allows you to store passwords
in a database without being able to see the actual password. When
building an application that uses hashed passwords for
authentication, the password entered by the user should be hashed,
then compared to the hashed value stored in the database. If they
match, you know the user entered a valid password. Here’s an
example using the Hash( )
function:
<CFSET MyHash = Hash('This is a test')> <CFOUTPUT>#MyHash#</CFOUTPUT>
Get Programming ColdFusion now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.