php - PHP如何从相同的字符串创建相同的哈希?
问题描述
还没有找到确切的答案。我想获取浏览器指纹,然后从指纹创建哈希并记录在 mysql 中。因此,当用户下次登录时,我将 mysql 哈希与特定登录的哈希进行比较,如果哈希不同,则决定向用户发送电子邮件。
问题是如何从相同的字符串创建相同的哈希?
试过了md5
$string = 'I could use a users IP address as the fingerprint, however, there could be multiple other users on the same IP. This is how passwords are typically stored (using this or another hash function, typically with a salt method added.) Checking a password is then done by hashing the input and comparing to the stored hash.';
echo md5($string). "\n";
echo md5($string). "\n";
echo md5($string). "\n";
示例在这里http://sandbox.onlinephpfunctions.com/code/8bd6dfc7a1ba69edb6e175c9a2c04d9a3704228b
正如我所见,所有哈希值都是相同的(在 2 个不同的浏览器上尝试过,所以时间也不同,哈希值相同)。那么我可以 100% 确定md5
从相同的字符串创建相同的哈希吗?
解决方案
推荐阅读
- javascript - Mac m1 节点 ffi-napi 抛出错误“找不到合适的图像”。和“ mach-o,但架构错误”
- python-3.x - 如何正确重新采样到 5 分钟
- extjs - 为什么 ExtJS 排序器函数必须返回 -1/0/1
- jboss - 如何使用 shrinkwrap Maven 解析器强制更新快照
- blockchain - 用 Solidity 编写的代码是如何执行的?
- javascript - querySelectorAll 不返回数组
- javascript - 如何使用 Javascript 动态设置表格样式?
- android - 在片段中实现 bottomSheet 行为
- sql - 如何将 SQL Server 中的图像插入到 VB.net 中的按钮上?
- android - 在 ViewPager 中获取屏幕上视图的位置