Skip to content

Instantly share code, notes, and snippets.

@neokoenig
Created July 5, 2011 10:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save neokoenig/1064616 to your computer and use it in GitHub Desktop.
Save neokoenig/1064616 to your computer and use it in GitHub Desktop.
Password Hashing and Salting 3
<!---Get the key--->
<cfset authKeyLocation=expandpath('../auth/key.txt')>
<cffile action="read" file="#authKeyLocation#" variable="authkey">
<!--- New password hashing --->
<!--- Generate a salt, this is never stored in it's plain form--->
<cfset theSalt=createUUID() />
<!--- Hash the password with the salt in it's plain form--->
<cfset passwordHash=Hash(thePassword & theSalt, 'SHA-512') />
<!--- The encrypted salt to store in the database, using the authKey--->
<cfset salt=encrypt(theSalt, authKey, 'CFMX_COMPAT')>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment