Author

Topic: php hash function (Read 512 times)

hero member
Activity: 784
Merit: 1000
May 20, 2014, 08:31:46 AM
#5
Thanks for the info!  I will keep researching and try to get a better understanding!
hero member
Activity: 1008
Merit: 500
May 20, 2014, 08:13:56 AM
#4
There are several different hash functions such as sha, md5, or haval. They can be applied to a string and return another string called a digest. Hash functions have some interesting properties:

* it is easy to compute the digest for any given string
* it is infeasible to generate a string that has a given digest
* it is infeasible to modify a string without changing the digest
* it is infeasible to find two different strings with the same digest.

You can learn more about hash functions on wikipedia (http://en.wikipedia.org/wiki/Cryptographic_hash_function)

The php function 'hash' takes two inputs, a hash algorithm such as sha256 and a string to be hashed. For example 'hash("sha256", $str)' will return the sha256-hash of the string $str. I guess what you are looking for is the hash of the concatenation of $var1, $var2, $var3. Try 'hash("sha256", $var1.$var2.$var3)'.
hero member
Activity: 784
Merit: 1000
May 20, 2014, 07:45:11 AM
#3
So I have tried asking around at the gambling sites what

hash('sha512, $var1, $var2, $var3) returns.
First, you're missing a '.

Anyway, according to the docs this won't return anything but an error:

Code:
$var1 $var2 $var3 1;
$hash hash('sha512'$var1$var2$var3);
var_dump($hash);
?>

Code:
Warning: hash() expects at most 3 parameters, 4 given in test.php on line 3
NULL

Sorry for the typo.

Errr, I am not asking what that code really does that I wrote, just a in general question.  I am trying to learn about the hash function, I did find some good information on it though
hero member
Activity: 576
Merit: 514
May 20, 2014, 02:25:12 AM
#2
So I have tried asking around at the gambling sites what

hash('sha512, $var1, $var2, $var3) returns.
First, you're missing a '.

Anyway, according to the docs this won't return anything but an error:

Code:
$var1 $var2 $var3 1;
$hash hash('sha512'$var1$var2$var3);
var_dump($hash);
?>

Code:
Warning: hash() expects at most 3 parameters, 4 given in test.php on line 3
NULL
hero member
Activity: 784
Merit: 1000
May 19, 2014, 08:43:56 AM
#1
So I have tried asking around at the gambling sites what

hash('sha512, $var1, $var2, $var3) returns.

No one has been able to give me an answer, yet they were all convinced they knew what it meant.


I am curious what value that returns.  Yes I understand it is the hash sha 512 value, I am more asking how does it calculate that

Does it randomize the 3 variables and return them as a 512 bit string in a completely random order?  Does it truncate certain variables and then randomize them?

Any thoughts on this anyone?

Thanks!
Jump to: