All,
I am using the following PHP function to salt & hash user passwords for a web app:
function stringHashing($password,$salt){
$hashedString=$password.$salt;
for ($i=0; $i<50; $i++){
$hashedString=hash('sha512',$password.$hashedString.$salt);
}
return $hashedString;
}
What is the best way to store the resulting string in MySQL? I suppose it is a fixed CHAR field? How should I go about calculating the right length?
Thanks,
JDelage
Well, SHA512 will always return a 512 bit hash, the two-argument
hash()method returns this as hex digits, so that’s 512 bits / 8 bits per byte * 2 hex digits per byte = 128 hex digitsA
CHAR(128)should be what you need