编译环境:Windows 7 +Delphi xe 10.3.2
封装了快递鸟接口,注意的坑:MD5要转为小写。
function TKDniaoAPI.StrtoMd5(const str: string): string; var AMD5: TIdHashMessageDigest5; begin AMD5 := TIdHashMessageDigest5.Create; try Result := AnsiLowerCase(AMD5.HashStringAsHex(str, IndyTextEncoding(TEncoding.UTF8))); //注意转小写 finally AMD5.Free; end; end;