|
|
@ -354,16 +354,16 @@ Function Get-FileChecksum($path, $algorithm = 'sha1') {
|
|
|
|
$hash = $raw_hash.Hash.ToLower()
|
|
|
|
$hash = $raw_hash.Hash.ToLower()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
Else {
|
|
|
|
Else {
|
|
|
|
$fp = [System.IO.File]::Open($path, [System.IO.Filemode]::Open, [System.IO.FileAccess]::Read, [System.IO.FileShare]::ReadWrite);
|
|
|
|
$fp = [System.IO.File]::Open($path, [System.IO.Filemode]::Open, [System.IO.FileAccess]::Read, [System.IO.FileShare]::ReadWrite)
|
|
|
|
$hash = [System.BitConverter]::ToString($sp.ComputeHash($fp)).Replace("-", "").ToLower();
|
|
|
|
$hash = [System.BitConverter]::ToString($sp.ComputeHash($fp)).Replace("-", "").ToLower()
|
|
|
|
$fp.Dispose();
|
|
|
|
$fp.Dispose()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
ElseIf (Test-Path -LiteralPath $path -PathType Container) {
|
|
|
|
ElseIf (Test-Path -LiteralPath $path -PathType Container) {
|
|
|
|
$hash = "3";
|
|
|
|
$hash = "3"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
Else {
|
|
|
|
Else {
|
|
|
|
$hash = "1";
|
|
|
|
$hash = "1"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return $hash
|
|
|
|
return $hash
|
|
|
|
}
|
|
|
|
}
|
|
|
|