Jump to content

[SOLVED] hash(sha512 ... values not syncing up


Lodius2000

Recommended Posts

Im working on a new user account management system, getting ready to make the login page... but

 

I discovered something wierd.... my hash values are not the same

 

before I post the script a few things:

I created an account, $myhash is what was placed in my database in the password field,

on the registration script the line $hash = hash("sha512",$password.$salt); is copy pasted,

the value of $salt is also copy pasted,

all these lines I made sure use the same style of quotes (single vs double).

the password of 'password' was also copy pasted from this testscript...

 

so here is my test script

 

<?php

$password = 'password';
$salt = 'hashme';
$hash = hash("sha512",$password.$salt);
//myhash comes straight from my database
$myhash = "0aadf252be8f696a28c46f03560f263eb51771d3617f65b06d4b039702cbd706005c41f41978df4bfa1122cf39f29fe41c169c66e4bfbea5b7ee4f44c0220d8d";
print $hash."<BR>";
print $myhash."<BR>";

print strlen($hash)."<BR>";
print strlen($myhash)."<BR>";

?>

 

this prints out

 

3068969b86a9132e08ce488841ef56a734d14278edfdd810ff0ea8ea412963e5f5e7f4358e27c1be4c900724bbb6c09af90c6255395a9baf26f653f6e3e0a774
0aadf252be8f696a28c46f03560f263eb51771d3617f65b06d4b039702cbd706005c41f41978df4bfa1122cf39f29fe41c169c66e4bfbea5b7ee4f44c0220d8d
128
128

 

as you can see, not the same....what gives?

 

EDIT: whoops guess I need to change my hash.... HAHA

//its changed now, but there were a couple of you who saw it

 

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.