Hi Daniweb,

I have a question for you guys. I've been reading up on PHP security and want to get it down pat before embarking on some projects I wish to do. The question right now is about how to create a table with PHP that will enable SHA1 hashing without requiring me to log in to phpMyAdmin and select it from the drop down. Basically, what I'm asking is can the SHA1 be written as part of a PHP table creation script?

Here's what I've tried.

$sql = "CREATE TABLE Members
   mem_id int(3) NOT NULL AUTO_INCREMENT,
   mem_username varchar(12) NOT NULL UNIQUE,
   mem_password [B][U][I]md5(varchar(12))[/I][/U][/B] 
7 Years
Discussion Span
Last Post by theausum

Hi Daniweb,

I've found my solution. You can't do something which I was trying to do -- use a hash when creating the table -- and the way to apply hashes to user passwords is done in the "INSERT" process.

Here's a link explaining how md5, sha, and sha1 hashing is used.


This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.