Quote:I have Hash class as follows: class Hash { public static function make($string, $salt='') { echo $string.$salt; return hash('sha256',$string.$salt); } public static function salt($length) { return mcrypt_create_iv($length); } public static function unique() { return self::make(uniqid()); } } I am colling method salt() with command: $salt=Hash::salt(32) Unfortunatelly, function mcrypt_create_iv is not working on newer php. How to redesign Hasch class? Thank you
class Hash { public static function make($string, $salt='') { echo $string.$salt; return hash('sha256',$string.$salt); } public static function salt($length) { return mcrypt_create_iv($length); } public static function unique() { return self::make(uniqid()); } }
public static function salt($length) { return random_bytes($length); }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)