计算SHA1哈希算法的Powershell V2.0 [英] Calculating SHA1 Hash Algorithm Powershell V2.0
本文介绍了计算SHA1哈希算法的Powershell V2.0的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
有谁知道是否可以计算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.
这篇关于计算SHA1哈希算法的Powershell V2.0的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文