Private/Crypto/Get-SecretSharingCipherConstant.ps1
|
function Get-SecretSharingCipherConstant { <# .SYNOPSIS Returns the SLIP-0039 constants used by the master-secret Feistel cipher. .DESCRIPTION BaseIterationCount and RoundCount together set the PBKDF2 iteration count for each Feistel round: (BaseIterationCount << IterationExponent) / RoundCount. CustomizationString is the ASCII "shamir" prefix mixed into the salt for non-extendable backups. MinimumSecretLength is SLIP-0039's 128-bit minimum master secret length, in bytes - it also happens to be the smallest length that keeps the PBKDF2 salt (SaltPrefix + R) at or above 8 bytes, which .NET's PBKDF2 implementation requires on Windows PowerShell 5.1's runtime (a stricter minimum than PBKDF2 itself needs, but every SLIP-0039-valid secret clears it). #> [CmdletBinding()] [OutputType([PSCustomObject])] param() return [PSCustomObject]@{ BaseIterationCount = 10000 RoundCount = 4 CustomizationString = [System.Text.Encoding]::ASCII.GetBytes('shamir') IdentifierLengthByte = 2 MinimumSecretLength = 16 } } |