Created
December 17, 2015 09:40
-
-
Save RaccoonDev/4b3fcc34be55e7633e66 to your computer and use it in GitHub Desktop.
Generate secure byte array and encode it with base64 string.
This file contains 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
param( | |
[int]$SecretArrayLength = 64 | |
) | |
$randomNumberGenerator = [System.Security.Cryptography.RandomNumberGenerator]::Create(); | |
$ba = [Byte[]] (,0 * $SecretArrayLength); | |
$randomNumberGenerator.GetBytes($ba, 0, $SecretArrayLength); | |
return [System.Convert]::ToBase64String($ba); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment