Skip to content

Instantly share code, notes, and snippets.

@sunnyc7
Created February 28, 2014 16:48
Show Gist options
  • Save sunnyc7/9274581 to your computer and use it in GitHub Desktop.
Save sunnyc7/9274581 to your computer and use it in GitHub Desktop.
Powershell RipeMD hashing implementation.
Function Get-RipeMDHash {
[cmdletbinding()]
Param(
[Parameter(Mandatory = $True)]
[ValidateScript({Test-Path $_ })]
$file
)
Process {
$reader = [System.IO.File]::OpenText($file)
$RIPEMD160 = [System.Security.Cryptography.RIPEMD160]::Create()
$encoding = [system.Text.Encoding]::UTF8
try {
for(;;) {
$line = $reader.ReadLine()
if ($line -eq $null) {
break
}
$temp = $RIPEMD160.ComputeHash($encoding.GetBytes($line))
[System.Convert]::ToBase64String($temp)
}
}
finally {
$reader.Close()
}
} #End of Process Block
}
#Verify if your RipeMD160 hash generated is accurate
#http://hash.online-convert.com/ripemd160-generator
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment