# code from http://aperturescience.su
# Enum HashFunction
# Contains possible hash functions to choose from
#
Add-Type -TypeDefinition @"
public enum HashFunction
{
sha1,
sha256,
sha384,
sha512,
md5,
ripemd160
}
"@
Function Get-FileHash
{
[CMDLetBinding()]
param
(
[Parameter(mandatory=$true, valuefrompipeline=$true)] [String] $File,
[HashFunction] $HashAlgorithm = "sha256",
[switch] $Group
)
Process
{
#check file exists, otherwise throw error
if (! (Test-Path $file))
{
throw "Could not find file $file"
}
...