Created
May 18, 2015 02:29
-
-
Save krciga22/8c0bdea99b28cf592589 to your computer and use it in GitHub Desktop.
Generate a random key of N size
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?PHP | |
// Generate a random key of N size | |
$keySize = 256; | |
$key = bin2hex(openssl_random_pseudo_bytes($keySize/2)); | |
echo 'Generating Key of size: '.$keySize; | |
echo '<br />Key: '.$key; | |
echo '<br />Length: '.strlen($key); | |
die(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment