Skip to content

Instantly share code, notes, and snippets.

@lennybacon
Last active August 7, 2024 10:35
Show Gist options
  • Save lennybacon/9fcce97f84d1b760e8da0e9d0738536a to your computer and use it in GitHub Desktop.
Save lennybacon/9fcce97f84d1b760e8da0e9d0738536a to your computer and use it in GitHub Desktop.
Generate a new AES 256 Key with PowerShell
$random = [System.Security.Cryptography.RandomNumberGenerator]::Create();
$buffer = New-Object byte[] 32;
$random.GetBytes($buffer);
[BitConverter]::ToString($buffer).Replace("-", [string]::Empty);
@lennybacon
Copy link
Author

Can you make a script that would add special characters in the key?

The output is the Hexadecimal representation of the key - by definition this is only 0-9 and a-f. Special characters are encoded in the same way.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment