计算文本HasH

Posted on 2019-05-16 23:29  努力成长静待花开  阅读(582)  评论(0编辑  收藏  举报

哈希被用来确定文本、查找重复的文件内容,以及验证密码

$text="this is the text that you want to convert into a hash"
$stream=[IO.MemoryStream]::new([Text.Encoding]::UTF8.GetBytes($text))
$hash=Get-FileHash -InputStream $stream -Algorithm SHA1
$stream.Close()
$stream.Dispose()
$hash

输出效果: