Question

What are the possible characters for $code:

$randStr = "some random string that contains only: [a-zA-Z0-9_]";
$code = hash('sha512', $randStr);
Was it helpful?

Solution

SHA512 will generate 128 characters of lowercase HEX characters (0 to f), e.g.

a9046c73e00331af68917d3804f70655a9046c73e00331af68917d3804f70655a9046c73e00331af68917d3804f70655

See the documentation for hash() for more information.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top