Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

php hash form string to integer

Tags:

php

integer

hash

Does PHP have a built in function for doing string to integer hashes, something that's difficult to reverse?

Now, I know I can probably get away with doing an md5, and treating a substring of it as a radix 16 number, but I'm looking for something built in.

Thanks.

like image 253
Allain Lalonde Avatar asked Jun 08 '09 14:06

Allain Lalonde


1 Answers

I think the best bet would chose a standard hash [either md5() or sha1()] to obtain a hash of your string, and then to get an integer hash, to a base_convert($hash, 16, 10) and that should convert your hash into a integer hash.

Hope I am understanding your issue correctly.

like image 97
JoshFinnie Avatar answered Oct 12 '22 00:10

JoshFinnie