{"id":174,"date":"2009-01-01T20:02:00","date_gmt":"2009-01-01T12:02:00","guid":{"rendered":""},"modified":"2013-11-18T21:42:59","modified_gmt":"2013-11-18T13:42:59","slug":"delphi%e8%8e%b7%e5%8f%96md5%e5%80%bc","status":"publish","type":"post","link":"https:\/\/kyle.ai\/blog\/174.html","title":{"rendered":"Delphi\u83b7\u53d6MD5\u503c"},"content":{"rendered":"<pre class=\"brush: delphi; title: ; notranslate\" title=\"\">\r\n\/\/\u83b7\u53d6\u6587\u4ef6\u7684MD5\u503c\r\nfunction TForm1.GetFileMD5(var path:string):string;\r\nvar filemd5:TIdHashMessageDigest5;\r\nbegin\r\n    filemd5:=TIdHashMessageDigest5.Create;    \/\/\u5fc5\u987b\u5148\u521d\u59cb\u5316\r\n    result:=filemd5.AsHex(filemd5.HashValue(TFileStream.Create(path,fmOpenRead)));\r\n    filemd5.Free;   \/\/\u6700\u540e\u5fc5\u987b\u91ca\u653e\u5bf9\u8c61\r\nend;\r\n\r\n\/\/\u83b7\u53d6\u6587\u672cMD5\u503c\r\nfunction GetMD5Hash(Str:String):String;\r\nvar\r\n   md5 : TIdHashMessageDigest5;\r\n   longWordRec : T4x4LongWordRecord;\r\nbegin\r\n   md5 := TIdHashMessageDigest5.Create;\r\n   longWordRec:=md5.HashValue(Trim(Str)); \/\/\u52a0\u5bc6\r\n   Result:= md5.AsHex(longWordRec);\r\n   md5.Free;\r\nend;\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>\/\/\u83b7\u53d6\u6587\u4ef6\u7684MD5\u503c function TForm1.GetFileMD5(var path:string) [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[6],"tags":[],"class_list":["post-174","post","type-post","status-publish","format-standard","hentry","category-code_related"],"_links":{"self":[{"href":"https:\/\/kyle.ai\/blog\/wp-json\/wp\/v2\/posts\/174","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/kyle.ai\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/kyle.ai\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/kyle.ai\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/kyle.ai\/blog\/wp-json\/wp\/v2\/comments?post=174"}],"version-history":[{"count":1,"href":"https:\/\/kyle.ai\/blog\/wp-json\/wp\/v2\/posts\/174\/revisions"}],"predecessor-version":[{"id":4806,"href":"https:\/\/kyle.ai\/blog\/wp-json\/wp\/v2\/posts\/174\/revisions\/4806"}],"wp:attachment":[{"href":"https:\/\/kyle.ai\/blog\/wp-json\/wp\/v2\/media?parent=174"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/kyle.ai\/blog\/wp-json\/wp\/v2\/categories?post=174"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/kyle.ai\/blog\/wp-json\/wp\/v2\/tags?post=174"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}