0.00

Hash methods in PHP: SHA512, SHA384, SHA256, SHA1, MD5 - HEX encoded

Sample hex Hash functions for PHP


programming language: php 7.0 or later
operating system: any
Updated:


Method definition: SHA512 / Hex - String

function Sha512Hex(string $str) : string {

	return (string) hash('sha512', $str, false);

}



Method definition: SHA384 / Hex - String

function Sha384Hex(string $str) : string {

	return (string) hash('sha384', $str, false);

}



Method definition: SHA256 / Hex - String

function Sha256Hex(string $str) : string {

	return (string) hash('sha256', $str, false);

}



Method definition: SHA1 / Hex - String

function Sha1Hex(string $str) : string {

	return (string) sha1($str);

}



Method definition: MD5 / Hex - String

function Md5Hex(string $str) : string {

	return (string) md5($str);

}