I’ve build a class for a login system. I’m using a function to generate a salt key on 128 bits. But when I run this function on the server ( GoDaddy Servers ) it tells me that thr round() has a wrong number of arguments. Though I’ve tested it a few times on local host and everything is fine.
Could you take a look at it and tell me what is wrong with it ?
function encrypt($str, $len=null) {
return (!empty($len)) ?
hash('sha512', str_pad($str, (strlen($str) + $len),substr(hash('sha512', $str),round(strlen($str)/3, 0,PHP_ROUND_HALF_UP),($len - strlen($str))),STR_PAD_BOTH)) :
hash('sha512', substr($str,round(strlen($str)/3, 0,PHP_ROUND_HALF_UP), 16));
}
They are probably using an older version of php. The third parameter of
round()was not added until php 5.3.0.http://php.net/manual/en/function.round.php
Edit: