首页 > 系统服务 > 详细

PowerShell计算字符串MD5 Hash值

时间:2020-11-10 20:32:52      阅读:149      评论:0      收藏:0      [点我收藏+]

 

$someString = "key=MTZl&batch=1&content=nihao1052020-11-10"
$md5 = New-Object -TypeName System.Security.Cryptography.MD5CryptoServiceProvider
$utf8 = New-Object -TypeName System.Text.UTF8Encoding
$hash = [System.BitConverter]::ToString($md5.ComputeHash($utf8.GetBytes($someString))).replace(‘-‘,‘‘).ToLower()
$hash

 

 

$someFilePath = "C:\foo.txt"
$md5 = New-Object -TypeName System.Security.Cryptography.MD5CryptoServiceProvider
$hash = [System.BitConverter]::ToString($md5.ComputeHash([System.IO.File]::ReadAllBytes($someFilePath)))

PowerShell计算字符串MD5 Hash值

原文:https://www.cnblogs.com/dreamer-fish/p/13955580.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!