lib/TMD.Hashing.ps1

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17


function Get-StringHash {
    param(
        [CmdletBinding()]
        [Parameter(mandatory = $true, ValueFromPipeline=$true)]
        [String]
        $String
        )

    $md5 = New-Object -TypeName System.Security.Cryptography.MD5CryptoServiceProvider
    $utf8 = New-Object -TypeName System.Text.UTF8Encoding

    return [System.BitConverter]::ToString($md5.ComputeHash($utf8.GetBytes($String)))
}