made md5 into generic checksum function that uses sha now
This commit is contained in:
parent
6376dda5c7
commit
8793308c39
1 changed files with 3 additions and 3 deletions
|
@ -142,14 +142,14 @@ Function ConvertTo-Bool
|
|||
return
|
||||
}
|
||||
|
||||
# Helper function to calculate md5 of a file in a way which powershell 3
|
||||
# Helper function to calculate a hash of a file in a way which powershell 3
|
||||
# and above can handle:
|
||||
Function Get-FileMd5($path)
|
||||
Function Get-FileChecksum($path)
|
||||
{
|
||||
$hash = ""
|
||||
If (Test-Path -PathType Leaf $path)
|
||||
{
|
||||
$sp = new-object -TypeName System.Security.Cryptography.MD5CryptoServiceProvider;
|
||||
$sp = new-object -TypeName System.Security.Cryptography.SHA1CryptoServiceProvider;
|
||||
$fp = [System.IO.File]::Open($path, [System.IO.Filemode]::Open, [System.IO.FileAccess]::Read);
|
||||
$hash = [System.BitConverter]::ToString($sp.ComputeHash($fp)).Replace("-", "").ToLower();
|
||||
$fp.Dispose();
|
||||
|
|
Loading…
Reference in a new issue