[Solved] How I can convert this function to php?


This should do the trick:

<?php

function hash_data($data)
{
    $data = mb_convert_encoding($data, 'UTF-16LE', 'UTF-8');
    $hash = hash('sha512', $data, true);
    return base64_encode($hash);
}

$user="admin";
$password = 'secret';
$key = "7f9facc418f74439c5e9709832;0ab8a5:OCOdN5Wl,q8SLIQz8i|8agmu¬s13Q7ZXyno/yv.XSN1DsgKq9zi]XrE^gx8vPC^Av8=e/bF4pX1Oe hfqGb#JK~RONkS1wx5w=RE0$" . "DxZSu7evPfshBw7p5Gb&suEkw=RE0DxZSu7e´vPfshBw7p+5GbsuEkw=H1fTWFXfsXo}z0fOd{KTt[IdDG2y6E=";
$data = $user . $password . $key;

// 6xecArT38JVtGKH2yQs/T6btOUF41vW5ptaPjgrd8hTaZZKnbJed5551LuYV7vR/Dr3Jb873JMvX0je+8XUpxw==
echo hash_data($data);

solved How I can convert this function to php?