Private/Digest/Invoke-SecretSharingHmacSha256.ps1

function Invoke-SecretSharingHmacSha256 {
    <#
    .SYNOPSIS
        Computes HMAC-SHA256(Key, Message) and returns the full 32-byte digest.
    #>

    [CmdletBinding()]
    [OutputType([byte[]], [System.Object[]])]
    param(
        [Parameter(Mandatory)]
        [byte[]]$Key,

        [Parameter(Mandatory)]
        [byte[]]$Message
    )

    $hmac = [System.Security.Cryptography.HMACSHA256]::new($Key)
    try {
        return , $hmac.ComputeHash($Message)
    } finally {
        $hmac.Dispose()
    }
}