<?php
function mac($msg)
{
$key = "7h3_1337_k3y";
$nonce = "5uc3m01";
$bloc_size = 64;
if(strlen($msg)==$bloc_size)
{
print("cas2");
$mac = $msg;
}
else if(strlen($msg)>$bloc_size)
{
print("cas3");
$mac = hash_hmac("sha512",$msg.$nonce,$key,true);
}
return crypt($mac,'$6$rounds=5000$OhMyG05h!');
}
$lemessage="UNMESSAGEASSEZGRANDPOURTOMBERDANSLECASDUCALCULDEHASHMAPETPOUVOIRREJOURSONMACPOURTOMBERDANSLECASCRYPTODIRECT"
$mac = mac($lemessage);
$valuemac=hash_hmac("sha512",$lemessage.$nonce,$key,true);
$mac2=eval('return hex2bin(\$valuemac);');
$b=mac($mac2);
if($mac==$b)
{
print("OK");
}
else{
print("KO");
}
print($mac);
print($b);
- Output for 5.5.24 - 5.5.30, 5.6.8 - 5.6.16, 7.0.0
- Parse error: syntax error, unexpected '$mac' (T_VARIABLE) in /in/6rT3c on line 23
Process exited with code 255.
preferences:
154.24 ms | 1395 KiB | 24 Q