{"id":9233,"date":"2024-03-27T16:20:36","date_gmt":"2024-03-27T08:20:36","guid":{"rendered":"\/?p=9233"},"modified":"2024-03-27T16:22:07","modified_gmt":"2024-03-27T08:22:07","slug":"%e6%96%87%e4%bb%b6%e7%9a%84md5%e5%80%bc","status":"publish","type":"post","link":"\/?p=9233","title":{"rendered":"\u6587\u4ef6\u7684md5\u503c"},"content":{"rendered":"<p><em>\u5177\u4f53\u6765\u8bf4\u6587\u4ef6\u7684MD5\u503c\u5c31\u50cf\u662f\u8fd9\u4e2a\u6587\u4ef6\u7684&quot;\u6570\u5b57\u6307\u7eb9&quot;<\/em>\u3002<\/p>\n<p>\u6bcf\u4e2a\u6587\u4ef6\u7684MD5\u503c\u662f\u4e0d\u540c\u7684,\u5982\u679c\u4efb\u4f55\u4eba\u5bf9\u6587\u4ef6\u505a\u4e86\u4efb\u4f55\u6539\u52a8,\u5176MD5\u503c\u4e5f\u5c31\u662f\u5bf9\u5e94\u7684&quot;\u6570\u5b57\u6307\u7eb9&quot;\u5c31\u4f1a\u53d1\u751f\u53d8\u5316\u3002<\/p>\n<p>\u6587\u4ef6\u7684MD5\u503c\u662f\u6839\u636e\u6587\u4ef6\u7684\u5185\u5bb9\uff08\u4e8c\u8fdb\u5236\u5185\u5bb9\uff09\u6765\u51b3\u5b9a\u7684\uff0c\u800c\u4e0d\u662f\u6839\u636e\u6587\u4ef6\u540d\u6216\u5176\u4ed6\u5143\u6570\u636e\u3002MD5\u662f\u4e00\u79cd\u6563\u5217\u51fd\u6570\uff0c\u5b83\u5c06\u4efb\u610f\u957f\u5ea6\u7684\u201c\u5b57\u8282\u4e32\u201d\u6620\u5c04\u4e3a\u4e00\u4e2a\u56fa\u5b9a\u957f\u5ea6\u7684\u5927\u6570\uff0c\u5e76\u4e14\u8bbe\u8ba1\u8005\u5bc4\u5e0c\u671b\u4e8e\u5b83\u65e0\u6cd5\u9006\u5411\u751f\u6210\uff0c\u4e5f\u5c31\u662f\u6240\u8c13\u7684\u201c\u96ea\u5d29\u6548\u5e94\u201d\u3002\u5177\u4f53\u6765\u8bf4\uff0cMD5\u7b97\u6cd5\u4f1a\u5bf9\u6587\u4ef6\u7684\u5185\u5bb9\u8fdb\u884c\u4e00\u7cfb\u5217\u7684\u4f4d\u64cd\u4f5c\u548c\u6570\u5b66\u8ba1\u7b97\uff0c\u6700\u7ec8\u751f\u6210\u4e00\u4e2a\u552f\u4e00\u7684128\u4f4d\u54c8\u5e0c\u503c\u3002<\/p>\n<p>\u5f53\u4f60\u66f4\u6539\u6587\u4ef6\u7684\u540d\u79f0\u65f6\uff0c\u5b9e\u9645\u4e0a\u53ea\u662f\u6539\u53d8\u4e86\u6587\u4ef6\u7684\u5143\u6570\u636e\uff0c\u5373\u6587\u4ef6\u5728\u6587\u4ef6\u7cfb\u7edf\u4e2d\u7684\u6807\u8bc6\u4fe1\u606f\uff0c\u800c\u6587\u4ef6\u7684\u5185\u5bb9\u5e76\u6ca1\u6709\u53d1\u751f\u53d8\u5316\u3002\u56e0\u6b64\uff0c\u6587\u4ef6\u7684MD5\u503c\u4e5f\u4e0d\u4f1a\u6539\u53d8\u3002MD5\u7b97\u6cd5\u5bf9\u6587\u4ef6\u5185\u5bb9\u7684\u6bcf\u4e00\u4e2a\u5b57\u8282\u90fd\u5f88\u654f\u611f\uff0c\u5373\u4f7f\u53ea\u6539\u52a8\u6587\u4ef6\u4e2d\u7684\u4e00\u4e2a\u5b57\u8282\uff0c\u4e5f\u4f1a\u5bfc\u81f4MD5\u503c\u53d1\u751f\u663e\u8457\u7684\u53d8\u5316\u3002\u4f46\u662f\uff0c\u5982\u679c\u4ec5\u4ec5\u662f\u6539\u53d8\u6587\u4ef6\u540d\u3001\u6587\u4ef6\u7684\u521b\u5efa\u65f6\u95f4\u6216\u4fee\u6539\u65f6\u95f4\u7b49\u5143\u6570\u636e\uff0c\u800c\u4e0d\u6539\u53d8\u6587\u4ef6\u7684\u5185\u5bb9\uff0c\u90a3\u4e48\u6587\u4ef6\u7684MD5\u503c\u5c06\u4fdd\u6301\u4e0d\u53d8\u3002<\/p>\n<p><strong>linux\u8ba1\u7b97md5\u503c\uff1a<\/strong><\/p>\n<pre><code class=\"language-shell\">md5sum &lt;file path&gt;<\/code><\/pre>\n<p><img src=\"https:\/\/lemon-guess.oss-cn-hangzhou.aliyuncs.com\/img\/image-20240327160716825.png\" alt=\"image-20240327160716825\" \/> <\/p>\n<p><strong>PowerShell\u8ba1\u7b97\uff1a<\/strong><\/p>\n<pre><code class=\"language-shell\">function Get-FileMd5 {  \n    param (  \n        [Parameter(Mandatory = $true)]  \n        [string]$FilePath  \n    )  \n\n    $md5 = New-Object -TypeName System.Security.Cryptography.MD5CryptoServiceProvider  \n    $fileStream = ([System.IO.File]::OpenRead($FilePath))  \n    $hashBytes = $md5.ComputeHash($fileStream)  \n    $fileStream.Dispose()  \n\n    $hashString = [System.BitConverter]::ToString($hashBytes).Replace(&#039;-&#039;, &#039;&#039;).ToLowerInvariant()  \n    return $hashString  \n}  \n\n# \u4f7f\u7528\u793a\u4f8b  \n$filePath = &quot;C:\\path\\to\\your\\file.txt&quot;  \n$md5Hash = Get-FileMd5 -FilePath $filePath  \nWrite-Host &quot;MD5 Hash of the file: $md5Hash&quot;<\/code><\/pre>\n<p><img src=\"https:\/\/lemon-guess.oss-cn-hangzhou.aliyuncs.com\/img\/image-20240327160831347.png\" alt=\"image-20240327160831347\" \/><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u5177\u4f53\u6765\u8bf4\u6587\u4ef6\u7684MD5\u503c\u5c31\u50cf\u662f\u8fd9\u4e2a\u6587\u4ef6\u7684&quot;\u6570\u5b57\u6307\u7eb9&quot;\u3002 \u6bcf\u4e2a\u6587\u4ef6\u7684MD5\u503c\u662f\u4e0d\u540c\u7684,\u5982\u679c\u4efb\u4f55\u4eba\u5bf9\u6587\u4ef6\u505a\u4e86\u4efb\u4f55\u6539\u52a8,\u5176M   \u2026 &#8230;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"ngg_post_thumbnail":0},"categories":[260],"tags":[],"_links":{"self":[{"href":"\/index.php?rest_route=\/wp\/v2\/posts\/9233"}],"collection":[{"href":"\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=9233"}],"version-history":[{"count":1,"href":"\/index.php?rest_route=\/wp\/v2\/posts\/9233\/revisions"}],"predecessor-version":[{"id":9234,"href":"\/index.php?rest_route=\/wp\/v2\/posts\/9233\/revisions\/9234"}],"wp:attachment":[{"href":"\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=9233"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=9233"},{"taxonomy":"post_tag","embeddable":true,"href":"\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=9233"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}