function sha1(input: string): string;
begin
with Tidhashsha1.Create do
try
Result := HashBytesAsHex(TidBytes(Bytesof(input)));
finally
free;
end;
end;
針對 sha1簽名,之前沒有涉及中文字符,一切正常,加入漢字後,簽名錯誤,需要使用下面方法
function sha1(input: string): string;
begin
with Tidhashsha1.Create do
try
//Result := HashBytesAsHex(TidBytes(Bytesof(input)));
Result := HashStringAsHex(input,IndyTextEncoding_UTF8);
finally
free;
end;
end;