Skip to content

Commit fccc1d9

Browse files
committed
optimizations
1 parent 5f41e9b commit fccc1d9

File tree

1 file changed

+7
-19
lines changed

1 file changed

+7
-19
lines changed

lib/md5.pas

Lines changed: 7 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -334,36 +334,24 @@ function MD5Print(var MD5: TMD5): TString;
334334
const
335335
thex: array [0..15] of char = ('0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F');
336336

337-
var i, a: byte;
338-
c: cardinal;
337+
var i,j,k, a: byte;
339338

339+
begin
340+
341+
Result[0]:=#32;
342+
i:=1;
340343

341-
procedure AddByte;
342-
var j: byte;
343-
begin
344-
344+
for k:=0 to 3 do
345345
for j:=3 downto 0 do begin
346346

347-
a := FourBytes( c )[j];
347+
a := FourBytes( md5.State[k] )[j];
348348

349349
Result[i]:=thex[a shr 4];
350350
Result[i+1]:=thex[a and $0f];
351351

352352
inc(i, 2);
353353
end;
354354

355-
end;
356-
357-
358-
begin
359-
360-
Result[0]:=#32;
361-
i:=1;
362-
363-
c := md5.State[0]; AddByte;
364-
c := md5.State[1]; AddByte;
365-
c := md5.State[2]; AddByte;
366-
c := md5.State[3]; AddByte;
367355

368356
end;
369357

0 commit comments

Comments
 (0)