phphashsha512

What are the possible output characters of sha512?


What are the possible characters for $code:

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

Solution

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

    a9046c73e00331af68917d3804f70655a9046c73e00331af68917d3804f70655a9046c73e00331af68917d3804f70655

    See the documentation for hash() for more information.