E-Rick Asked: 2022-07-12 23:47:42 +0800 CST 2022-07-12 23:47:42 +0800 CST 2022-07-12 23:47:42 +0800 CST How to create a hash like this done in Node.js but in php? 772 How to create a hash like this done in Node.js but in php. const bdHash = criptoHub.sha256(stringToHash, KEY); php 1 Answers Voted Best Answer Peter Petrov 2022-07-13T01:24:06+08:002022-07-13T01:24:06+08:00 PHP has a native function: hash hash ("algoritmo_a_usar", $datos, [true / false]) If the third parameter is omitted, since it is optional (hence the square brackets), it will be assumed to be false, which the function will interpret as output in hexadecimal. If specified true, the output of the hash will be in raw binary. For a list of supported algorithms, you can do <?php print_r(hash_algos()); ?>
PHP has a native function: hash
hash ("algoritmo_a_usar", $datos, [true / false])
If the third parameter is omitted, since it is optional (hence the square brackets), it will be assumed to be
false
, which the function will interpret as output in hexadecimal. If specifiedtrue
, the output of the hash will be in raw binary.For a list of supported algorithms, you can do