Hashing Passwords
After being criticized for my last post about 2 way encryption of passwords i have decided to write a post about hashing your passwords. As was pointed out in my last post this is a more secure way of keeping your password data safe.
Hashing passwords in a database is very easy, the syntax of the hash function is
To hash the data into the database, we will use an insert query and insert the hashed password.
INSERT INTO users (username, password)
VALUES (<cfqueryparam value="#FORM.Nusername#" cfsqltype="cf_sql_clob" maxlength="255">, <cfqueryparam value="#Hash(form.password)#"" cfsqltype="cf_sql_clob" maxlength="255">)
</cfquery>
This is essentially very simple to do. To check if the user has entered the correct password to login we simply use a script like this.
SELECT Password
FROM Users
WHERE Username = <cfqueryparam value = "#Username#"
cfsqltype = "CF_SQL_CHARVAR">
</cfquery>
<cfif Hash(form.password) is not checkpassword.password>
<cflocation url = "loginfailed.cfm">
<cfelse>
...
</cfif>
The main difference between this and my last post about 2 way encryption of passwords, is that the password is never unencrypted so there is less chance of anyone finding it out.

Also I'd probably check the Hashed password in your SQL WHERE clause in case you have more than one user with the same username (it does happen!)
http://www.nikeairmaxtrainers.co.uk/nike-air-max-shoes-nike-air-max-90-c-39_52.html" target="_blank">http://www.nikeairmaxtrainers.co.uk/nike-air-max-s...
http://www.nikeairmaxtrainers.co.uk/nike-air-max-shoes-nike-air-max-95-c-39_61.html" target="_blank">http://www.nikeairmaxtrainers.co.uk/nike-air-max-s...
http://www.nikeairmaxtrainers.co.uk/nike-air-max-shoes-c-39.html
http://www.nikeairmaxtrainers.co.uk/nike-air-max-shoes-nike-air-max-97-c-39_80.html" target="_blank">http://www.nikeairmaxtrainers.co.uk/nike-air-max-s...
http://www.nikeairmaxtrainers.co.uk/nike-air-max-shoes-nike-air-max-95-c-39_61.html" target="_blank">http://www.nikeairmaxtrainers.co.uk/nike-air-max-s...
http://www.nikeairmaxtrainers.co.uk/nike-air-max-shoes-nike-air-max-ltd-c-39_42.html" target="_blank">http://www.nikeairmaxtrainers.co.uk/nike-air-max-s...
http://www.nikeairmaxtrainers.co.uk/nike-air-max-shoes-nike-air-max-ltd-ii-c-39_84.html" target="_blank">http://www.nikeairmaxtrainers.co.uk/nike-air-max-s...
http://www.nikeairmaxtrainers.co.uk/nike-air-max-shoes-nike-air-max-bw-c-39_65.html
http://www.nikeairmaxtrainers.co.uk/nike-shox-shoes-nike-shox-nz-c-1_16.html" target="_blank">http://www.nikeairmaxtrainers.co.uk/nike-shox-shoe...
http://www.nikeairmaxtrainers.co.uk/nike-shox-shoes-nike-shox-r4-c-1_2.html" target="_blank">http://www.nikeairmaxtrainers.co.uk/nike-shox-shoe...
http://www.nikeairmaxtrainers.co.uk/nike-air-max-shoes-nike-air-presto-c-39_77.html" target="_blank">http://www.nikeairmaxtrainers.co.uk/nike-air-max-s...
http://www.myairmax.com/
http://www.myairmax.com/nike-airmax-shoes-nike-airmax-180-c-1_244.html
http://www.myairmax.com/nike-airmax-shoes-nike-airmax-360-c-1_307.html
http://www.myairmax.com/nike-airmax-shoes-nike-airmax-87-c-1_255.html
http://www.myairmax.com/nike-airmax-shoes-nike-airmax-90-c-1_3.html" target="_blank">http://www.myairmax.com/nike-airmax-shoes-nike-air...
http://www.myairmax.com/nike-airmax-shoes-nike-airmax-95-c-1_2.html" target="_blank">http://www.myairmax.com/nike-airmax-shoes-nike-air...
http://www.myairmax.com/nike-airmax-shoes-nike-airmax-97-c-1_306.html
http://www.myairmax.com/nike-airmax-shoes-nike-air-max-ltd-c-1_117.html" target="_blank">http://www.myairmax.com/nike-airmax-shoes-nike-air...