- crypt: documentation ( source)
- urlencode: documentation ( source)
- base64_encode: documentation ( source)
- fclose: documentation ( source)
- fread: documentation ( source)
- fopen: documentation ( source)
<?php
$validPassword = urlencode('111');
// Generate Random Salt using linux
$fp = fopen('/dev/urandom', 'r');
$randomString = fread($fp, 32);
fclose($fp);
$salt = base64_encode($randomString);
$hashed_password = crypt($validPassword, '$6$rounds=5000$'.$salt.'$');