大致代碼如下:var
Input,Output,Key:PChar;
......
Getmem(Input,128);
Getmem(Output,128);
Getmem(Key,16);
Fillchar(Input^,128,#0);
Fillchar(Key^,16,#0);
Fillchar(Output^,128,#0);
CopyMemory(Key,PChar(md5.MD5Print(md5.MD5String(Copy(ver,0,16)+copy(key1,17,16)))),16);
CopyMemory(Input,PChar(Copy(restr,34,Length(restr)-33)),Length(restr)-33);
DES(Output,Input,128,Key,16,False);
AContext.Connection.Socket.Write(Output);
Freemem(Input);
Freemem(Output);
Freemem(Key);這樣子在客戶端接收到的都是不定長的數據,很難處理。想向大家請教下怎么樣可以達到我想要的目的,也就是標題上提到的。謝謝
Input,Output,Key:PChar;
......
Getmem(Input,128);
Getmem(Output,128);
Getmem(Key,16);
Fillchar(Input^,128,#0);
Fillchar(Key^,16,#0);
Fillchar(Output^,128,#0);
CopyMemory(Key,PChar(md5.MD5Print(md5.MD5String(Copy(ver,0,16)+copy(key1,17,16)))),16);
CopyMemory(Input,PChar(Copy(restr,34,Length(restr)-33)),Length(restr)-33);
DES(Output,Input,128,Key,16,False);
AContext.Connection.Socket.Write(Output);
Freemem(Input);
Freemem(Output);
Freemem(Key);這樣子在客戶端接收到的都是不定長的數據,很難處理。想向大家請教下怎么樣可以達到我想要的目的,也就是標題上提到的。謝謝
Output也可以定义为String,GetMem(Output,128)可以换为SetLength(Output,128)