Skip to content

Instantly share code, notes, and snippets.

@wandersonwhcr
Last active August 25, 2017 14:42
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wandersonwhcr/5bf714eb67a873c5b4451739073078b0 to your computer and use it in GitHub Desktop.
Save wandersonwhcr/5bf714eb67a873c5b4451739073078b0 to your computer and use it in GitHub Desktop.
Hash Generator - Generates Random Tokens and Hashes Manually
<?php
$type = 'SHA512';
$hashes = [
'MD5' => 128,
'SHA1' => 160,
'SHA256' => 256,
'SHA512' => 512,
];
echo bin2hex(openssl_random_pseudo_bytes($hashes[$type] / 8)) . PHP_EOL;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment