有谁知道是否可以计算SHA1哈希在PowerShell中V2.0?
Does anyone know if it is possible to calculate a SHA1 Hash in Powershell V2.0?
唯一的信息,我可以在网上找到的是使用PowerShell V4.0。
The only information I can find online is with Powershell V4.0.
我不记得在PowerShell的V2天,.NET 3.5是典型的安装了。我认为这是这样的。
I can't remember back in Powershell V2 days, .NET 3.5 was typically installed too. I think it's the case.
您可以尝试以下,看看它的工作原理:
You can always try the following and see if it works:
$file = 'd:\scripts\sha1.ps1'
$sha1 = New-Object System.Security.Cryptography.SHA1CryptoServiceProvider
[System.BitConverter]::ToString( $sha1.ComputeHash([System.IO.File]::ReadAllBytes($file)))
替换 $文件中的值
和你有一个文件名。
Replace the value of $file
with the name of a file you have.