Emir Posted December 7, 2006 Share Posted December 7, 2006 Hello,This may be a stupid question, but I was wondering whether the PASSWORD() function stores the data as a larger or smaller size in the destination table field:Say I have a PHP/HTML form that has a password input. I have the maxlength property of 30 for this field. I happen to enter a password that is 30 characters in length. When this field is sent to the database and encrypted with the PASSWORD() function, does it make it larger, smaller, or the same size.I am just wondering this because I am not sure whether I should keep the same size for my Form and for my Table's Field.Any help would be greatly appreciated,Thank you,Emir Quote Link to comment Share on other sites More sharing options...
artacus Posted December 7, 2006 Share Posted December 7, 2006 The length of the password before isn't related to its length after encryptionSELECT PASSWORD('f') //*241E241B694B4F0B740CF5B9775AFD9A511E1CECSELECT PASSWORD('This is my really really long password')//*23218AC3A2F0CA3DF720A86F399AF85C36CFDEDE Quote Link to comment Share on other sites More sharing options...
Emir Posted December 7, 2006 Author Share Posted December 7, 2006 So if that is the case, would I set the length of my table field to 40 in order to be able to contain all of the encrypted characters? So, in the end I would have a PHP/HTML form with a maxlength of 30 (or something), while I would set the length of the database table field to 40.That is where I am getting confused.Thanks again for the help. Quote Link to comment Share on other sites More sharing options...
artacus Posted December 7, 2006 Share Posted December 7, 2006 You probably don't need more than 8 to 10 characters on the html form. But you don't really even need to worry about it. Just set the db field wide enough to store the output of PASSWORD() Quote Link to comment Share on other sites More sharing options...
fenway Posted December 9, 2006 Share Posted December 9, 2006 Correct -- PASSWORD() uses a one-way hash function that produces a fixed-length string. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.