I have written a PowerShell script to generate passphrases.
It uses two files to get words from (5-LetterNouns.txt and 5-LetterAdjectives.txt). You can get these files from Git Hub. There are a few of them out there.
I like using real words more than that mixed character-symbol-number stuff. It makes me remember things easier.
Here is the code.
function Get-RandomWord {
$lines = Get-Content -Path "$PSScriptroot\5-LetterNouns.txt"
$words = $lines -split '`n' # Split content into words
$randomWord = Get-Random -InputObject $words
return $randomWord
}
function Get-RandomAdjective {
$lines = Get-Content -Path "$PSScriptroot\5-LetterAdjectives.txt"
$adjectives = $lines -split ' ' # Split content into words
$randomAdjective = Get-Random -InputObject $adjectives
return $randomAdjective
}
function Generate_PassPhrase {
$selectedAdjective1 = Get-RandomAdjective
$selectedAdjective1 = (Get-Culture).TextInfo.ToTitleCase($selectedAdjective1.ToLower())
$selectedWord = Get-RandomWord
$someNumber = Get-Random -Minimum 0 -Maximum 9
$Generate_PassPhrase = "$SelectedAdjective1 $selectedWord $someNumber"
return $Generate_PassPhrase
}
for ($i = 1; $i -le 10; $i++) {
$NewPassPhrase = Generate_PassPhrase
Write-Output $NewPassPhrase
}
Here is a sample output:
Lanky dance 3
Grand world 2
Right silly 1
Joint earth 5
Tired tower 3
Black shake 1
Worse split 0
Glass bonus 5
Bumpy other 1
Brown block 8
The script generates 10 passphrases at a time, you can change the for loop if you need more choices.
No comments:
Post a Comment