Private/Wordlist/Get-SecretSharingWordlist.ps1
|
function Get-SecretSharingWordlist { <# .SYNOPSIS Returns the official 1024-word SLIP-0039 English wordlist. .DESCRIPTION Loads (once, cached for the module session) Private/Wordlist/wordlist.txt - the wordlist sourced verbatim from the SLIP-0039 reference implementation (trezor/python-shamir-mnemonic). A word's position in this list (0-1023) is its 10-bit mnemonic value; the file's alphabetical ordering is incidental to how the words were selected, not something this mapping depends on. #> [CmdletBinding()] [OutputType([string[]], [System.Object[]])] param() if ($script:SecretSharingWordlist) { return $script:SecretSharingWordlist } $path = Join-Path $script:ModuleRoot 'Private/Wordlist/wordlist.txt' $words = @(Get-Content -Path $path) if ($words.Count -ne 1024) { throw "The wordlist should contain 1024 words, but it contains $($words.Count)." } $script:SecretSharingWordlist = $words return $script:SecretSharingWordlist } |