Hashing

In php, you can generate md5 or sha1 hashes by using the md5() and sha1() functions respectively.

You can also use the hash() function which I believe is much quicker. This function is available in PHP 5 >= 5.1.2.

Anyway, to get a list of the available hashing algorithms, just execute the following code.

<?php
print_r(hash_algos());
?>

Once you've decided on an algorithm, let's use md5 for this example, execute the following command,

<?php
echo(hash("md5","String to hash"));
?>

You can also use hash_file() to find a hash of a file with similar syntax.

<?php
echo(hash_file("md5","/path/to/file.txt"));
?>

Page Comments (Click to edit)






[Click to add or edit comments])

Please prepend comments below including a date

Design by N.Design Studio, adapted by solidGone.org (version 1.0.0)
Have a nice day.