使用Salt UTF-16加密密码

时间:2017-05-11 11:26:10

标签: salt utf-16

我需要使用salt加密密码,它必须是UTF 16。

这就是我现在所拥有的,但他们告诉我它的UTF-8

$key = 'dfs7dsfsdf';
$timestamp = '201705111500';
$concat = $key . $timestamp;
$hash = hash('sha256', $concat);

1 个答案:

答案 0 :(得分:2)

试试这个

$key = 'dfs7dsfsdf';
$timestamp = '201705111500';
$concat = $key . $timestamp;
$cString = mb_convert_encoding($total, "UTF-16LE");
$hash = hash('sha256', $cString);

你忘记了

$cString = mb_convert_encoding($total, "UTF-16LE");