View Full Version : Password hashing?

04-04-2007, 04:07 AM
I have a cgi script written in c++ that interacts with a mysql database. My question is this: How can I, from the administrator html page, use sha1 to hash passwords as I add new users to the website?

I'll be creating their usernames and passwords myself and was wondering if I could use a function such as sha1 (or something else?) to hash the password and then store it into the database. Any help would be greatly appreciated.

04-04-2007, 10:37 AM
(userid, password, othercolumns)
('xxx',sha1('passwordhere'),'blah blah blah values')

you then compare the SHA1 of the password they subsequently log in with and the stored password

SELECT count(*)
FROM yourdatabase
WHERE userid=$userid
AND password = sha1('$password')

if the count is 1 you let them in otherwise reject them.

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum