PHP already comes with a range of hash algorithms available for use, including it has a specific function to show which algorithms are available, hash_algos()
.
When you run this function, it returns a array
with all available methods, eg:
print_r(hash_algos());
The code above would print the following:
Array
(
[0] => md4
[1] => md5
[2] => sha1
[3] => sha256
[4] => sha384
[5] => sha512
[6] => ripemd128
[7] => ripemd160
[8] => whirlpool
// ...
To use a specific algorithm you can use the hash()
function, for example:
echo hash("crc32b", "minha-string");
// imprime: 5373ff38