Initial community commit
This commit is contained in:
parent
537bcbc862
commit
fc06254474
16440 changed files with 4239995 additions and 2 deletions
|
@ -0,0 +1,18 @@
|
|||
param([String]$filename="", [Int32]$filesize=0, [String]$hashvalue="", [String]$hashname="SHA512")
|
||||
Function Get-FileHashWin7([String] $FileName, $HashName) {
|
||||
$FileStream = New-Object System.IO.FileStream($FileName,[System.IO.FileMode]::Open)
|
||||
$StringBuilder = New-Object System.Text.StringBuilder
|
||||
[System.Security.Cryptography.HashAlgorithm]::Create($HashName).ComputeHash($FileStream)|%{[Void]$StringBuilder.Append($_.ToString("x2"))}
|
||||
$FileStream.Close()
|
||||
$StringBuilder.ToString()
|
||||
}
|
||||
Write-Output "Verify " $filename
|
||||
if ((Get-Item $filename).length -ne $filesize) {
|
||||
Write-Output "Failed " $filename
|
||||
exit 1
|
||||
}
|
||||
if ((Get-FileHashWin7 $filename $hashname) -ne $hashvalue) {
|
||||
Write-Output "Failed " $filename
|
||||
exit 1
|
||||
}
|
||||
exit 0
|
Loading…
Add table
Add a link
Reference in a new issue