php hash表单字符串为整数 [英] php hash form string to integer
问题描述
PHP是否有内置函数来执行字符串到整数哈希,这是难以逆转的东西?
Does PHP have a built in function for doing string to integer hashes, something that's difficult to reverse?
现在,我知道我可以放弃做一个md5,并将其子字符串视为基数为16的数字,但我正在寻找内置的东西。
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.
谢谢。
推荐答案
我认为最好的选择是选择标准哈希[ md5()
或 sha1()
]获取字符串的哈希值,然后获得整数哈希,得到 base_convert($ hash,16,10)
那应该将你的哈希值转换为整数哈希。
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.
这篇关于php hash表单字符串为整数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!