$hash_list=hash_algos(); //Return the registered hash rule list
print_r($hash_list); //Display the results
Create a file to calculate the hash value: file_put_contents('example.txt', 'the quick brown fox jumped over the lazy dog.');
Output hash value information:
echo hash_file('md5', 'example.txt');
$str="the quick brown fox jumped over the lazy dog."; //Define string
echo hash('ripemd160',$str); //Generate hash value
$ctx=hash_init('md5'); //Initialize a hash value
hash_update($ctx,'the quick brown fox'); //Pour data into the hash value
hash_update($ctx,'jumped over the lazy dog.'); //Pour data into the hash value
echo hash_final ($ctx); // Output the final result
$str="the quick brown fox jumped over the lazy dog."; // Define the string
$fp=tmpfile(); File ifwrite ($ FP, $ STR); // Write the string into temporary files
rewind ($ fp); // back to the position of the file pointer
$ ctx = hash_init ('md5'); //Initialize a hash value
hash_update_stream($ctx,$fp); brown fox jumped over the lazy dog."; //Define string
echo hash_hmac('ripemd160',$str,'secret'); //Generate a hash value containing the key
/*Create a file And write the string into it */
$file="example.txt"; //Define the file name
$str=" the quick brown fox jumped over the lazy dog."; //Define the string
file_put_contents($file,$str); //Write a string to the file
echo hash_hmac_file('md5',$file,'secret'); //Generate a hash value containing the key
$ ctx=hash_init('sha1'); //Define the string
hash_update($ctx,'the quick brown fox jumped over the lazy dog.'); //Pour data into the hash value
echo hash_final($ ctx); //Output results
//Open source code phpfensi.com