How so I convert this SHA256 + BASE64 from Swift to PHP?

懵懂的女人 提交于 2019-12-02 11:11:33

You should set raw output to true for hash method in PHP. Notice the third method argument in hash

$hashedStr = hash('sha256', $inputStr, true);
$finalStr = base64_encode($hashedStr);
echo $finalStr;

This way the base64_encoded raw value from PHP should be equal to the one that you get from base64EncodedString

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!