[DUG] Problem converting this

Jeremy Coulter jscoulter at gmail.com
Mon Mar 27 08:32:12 NZDT 2017


Hi all. It might be I have been mucking around with this too much and have
just simply got confused!

I am converting some code from Delphi 2007 to 10.1.
I am having an issue on D 10.1 with this code which is fin under 2007 and
it will be due to the unicode stuff that was introduced.
Can someone let me know how I would convert this to be 10.1 compatible? I
have spent some time on it and not really got any where.

Thanks, Jeremy

function encode_password(passw, hash: string): string;
var
  ac, temp: string;
  pc: array of char;
  i, lp: integer;
begin
 if (hash<>'') and (passw<>'')
  then begin
        lp:=length(passw);
        setlength(pc,1+lp+16);
        pc[0]:=#0;
        move(passw[1],pc[1],lp);
        for i:=0 to 15
         do begin
             ac:=copy(hash,i*2+1,2);
             if ac<>''
              then pc[1+lp+i]:=Chr(StrToInt('$' + ac));
            end;
        temp:=GetMD5(@pc[0], 1+lp+16);  //GETMD5 is in the OverByteICS code
so should be ok
       end
  else begin
        temp:='#error#';
       end;
 result:=lowercase(temp);
end;
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://listserver.123.net.nz/pipermail/delphi/attachments/20170327/7667def6/attachment.html 


More information about the Delphi mailing list