From 231599f8be98d8729fe246a98e1698252524760c Mon Sep 17 00:00:00 2001 From: "Gaunt, John" Date: Tue, 27 Feb 2018 15:13:48 -0500 Subject: [PATCH] Add new file --- signed gpg license key.ps1 | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 signed gpg license key.ps1 diff --git a/signed gpg license key.ps1 b/signed gpg license key.ps1 new file mode 100644 index 0000000..4a8a10f --- /dev/null +++ b/signed gpg license key.ps1 @@ -0,0 +1,22 @@ +Function Get-RandomAlphanumericString { + + [CmdletBinding()] + Param ( + [int] $length = 5 + ) + # Numbers: (0x30..0x39) + # Lower Case: ( 0x61..0x7A) + # Upper Case: ( 0x41..0x5A) + return ( -join ((0x30..0x39) + ( 0x41..0x5A) | Get-Random -Count $length | % {[char]$_}) ) +} +$key = "" +(1..5) | % { + if ($_ -eq 5) { + $key += (Get-RandomAlphanumericString) + $key = "License Key: " + $key + } else { + $key += (Get-RandomAlphanumericString) + "-" + } +} + +$key | gpg --clearsign > ./license.key \ No newline at end of file