Hello This is my current code I’m working on:
$uname = "unholybanana";
$pass = "choykiller13";
$salt = salty();
$password = sha1 ( $uname . $pass . $salt );
echo $password;
function salty() {
mt_srand(microtime(true)*100000 + memory_get_usage(true));
return md5(uniqid(mt_rand(), true));
}
So far my problem is $password echos $uname+$pass hashed mixed but it doesn’t mix with salt anyone can point out a problem with this. I’m currently just using sha1 for learning purposes rather than go straight to scrypt and bcrypt. Also this is what would i do to insert the data into the db:
$sql= "INERT into test SET uname='$uname', hashpass='$password', salt='$salt'";
Would be great if anyone can spot if there is a problem with my insert above.
So far i have no idea how am i able to validate this.(syntax) would appreciate anyone would point me in a good direction.
But i think it should be still thinking how i would go about coding this.
$checkpass= sha1 ( $uname . $pass . $salt ) == $hashpass;
Also i wanted to add $uname because all of my unames are given to the client so all unames would look like this C-9183102.
Would appreciate any help thanks!
You almost definitely want
instead of
INERT.