[英]Base64 + sha256 not giving expected result
I need to figure out why I get the wrong results, here is the thing: 我需要弄清楚为什么我得到错误的结果,这是东西:
Expected result 预期结果
Mu0FBjARVsNyDiixnKqyLCCqVunTSPQFCMnOwGQsIWliY2Jh Mu0FBjARVsNyDiixnKqyLCCqVunTSPQFCMnOwGQsIWliY2Jh
Current Result 当前结果
MzJlZDA1MDYzMDExNTZjMzcyMGUyOGIxOWNhYWIyMmMyMGFhNTZlOWQzNDhmNDA1MDhjOWNlYzA2NDJjMjE2OQ== MzJlZDA1MDYzMDExNTZjMzcyMGUyOGIxOWNhYWIyMmMyMGFhNTZlOWQzNDhmNDA1MDhjOWNlYzA2NDJjMjE2OQ ==
The code I'm using (php) 我正在使用的代码(php)
echo base64_encode(hash("sha256", $pass.$salt'));
This site http://www.insidepro.com/hashes.php giveme a preety closer result 这个网站http://www.insidepro.com/hashes.php Giveme一个漂亮的结果
sha256($pass.$salt) => Mu0FBjARVsNyDiixnKqyLCCqVunTSPQFCMnOwGQsIWk= sha256($ pass。$ salt)=> Mu0FBjARVsNyDiixnKqyLCCqVunTSPQFCMnOwGQsIWk =
you can find (in the site, near the result field) a [1], that means "Hash in Base64" 您可以在网站的结果字段附近找到[1],表示“哈希在Base64中”
the thing is... I can't even get the sites result 问题是...我什至无法获得网站结果
EDIT (Thanks Jon) 编辑(谢谢乔恩)
now the code goes like this 现在代码像这样
echo base64_encode(hash("sha256", $pass.$salt', true));
I'm getting the same result as in the site 我得到的结果与该网站相同
the problem now is the difference between the two results 现在的问题是两个结果之间的差异
actual result : Mu0FBjARVsNyDiixnKqyLCCqVunTSPQFCMnOwGQsIWk=
expected result : Mu0FBjARVsNyDiixnKqyLCCqVunTSPQFCMnOwGQsIWliY2Jh
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.