Private/Checksum/Test-SecretSharingChecksum.ps1

function Test-SecretSharingChecksum {
    <#
    .SYNOPSIS
        Verifies a SLIP-0039 share's data words (including its trailing 3-word
        checksum) against the RS1024 checksum.
    .DESCRIPTION
        Data must already include the 3 checksum words appended at the end (as
        produced by New-SecretSharingChecksum). Recomputes the RS1024 polymod over the
        customization string + the full Data sequence and checks it equals exactly 1,
        which holds only for a correctly checksummed, unmodified (or at most
        3-word-error) sequence.
    #>

    [CmdletBinding()]
    [OutputType([bool])]
    param(
        [Parameter(Mandatory)]
        [int[]]$Data,

        [switch]$Extendable
    )

    $customizationString = Get-SecretSharingChecksumCustomizationString -Extendable:$Extendable
    $values = [int[]]($customizationString + $Data)

    return (Invoke-SecretSharingRs1024Polymod -Value $values) -eq 1
}