16,748
社区成员
发帖
与我相关
我的任务
分享
function EncodeAnsi(const s: string): string;
var
sha1_bytes: TSHA1Digest;
base64_stream: TStream;
begin
sha1_bytes := SHA1String(AnsiToUtf8(s));
base64_stream := TMemoryStream.Create;
try
base64_stream.WriteBuffer(sha1_bytes, SizeOf(sha1_bytes));
base64_stream.Position := 0;
Base64Encode(base64_stream, Result);
finally
base64_stream.Free;
end;
end;
用到了cnvcl的CnSHA1、CnBase64
D7/D2007测试通过。
http://pan.baidu.com/s/1c01A1Ug