如 :
MD5File('D:\dtem\Dll\VTDReg.dll') =
6ffb109a288a89227ef734bc97995429md5函数里有 把byte数组转化为string 函数
function MD5Print(D: MD5Digest): string;
var
I: byte;
const
Digits: array[0..15] of char =
('0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f');
begin
Result := '';
for I := 0 to 15 do Result := Result + Digits[(D[I] shr 4) and $0f] + Digits[D[I] and $0f];
end;我想用 byte[0..15]来保存md5 值 而不是 string
MD5File('D:\dtem\Dll\VTDReg.dll') =
6ffb109a288a89227ef734bc97995429md5函数里有 把byte数组转化为string 函数
function MD5Print(D: MD5Digest): string;
var
I: byte;
const
Digits: array[0..15] of char =
('0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f');
begin
Result := '';
for I := 0 to 15 do Result := Result + Digits[(D[I] shr 4) and $0f] + Digits[D[I] and $0f];
end;我想用 byte[0..15]来保存md5 值 而不是 string
BinToHex
HexToBin
好像用HexToBin,自个试下。
var
I ,Len: Integer;
s:Byte;
begin
len:=length(ByteArr);
Result:='';
for i:=0 to len-1 do
begin
s:=ByteArr[i];
Result:=Result +' '+IntToHex(s,2); //将字符串转化为16进制字符串,并以空格间隔。
end;
Delete(Result,1,1); //删去字符串中第一个空格
end;然后用strmove填充过去
存储到 array[0..15] of byte 而不是 byte ->string !