...
Excerpt |
---|
PHP provides a simple function can hash in 32bits - hash( $algorithm, $key) - it will provide 8 bytes string as hash result. |
...
Code Block |
---|
$key = "Chun Kang"; echo hash("crc32b", $key); |
If you want more secure method, you can add salt like below:
Code Block |
---|
function customHash($key, $salt="Genius")
{
$key .= $salt;
return hash( "crc32b", $key);
}
$key = "Chun Kang";
echo customHash("crc32b", $key); |