Delphi 7 - Not Enough Actual Parameters -
i'm new delphi 7, in forum , i've questions.
i have converted url string hex using jorlen young's function strtohex - advanced encryption standard (aes) interface unit v1.3!.
but, when implement function encryptstring, got error @ bottom of code: encrypt := encryptstring('www.website.com'); following messsage:
[hint] unit1.pas(xx): variable 'st' declared never used in 'encryptstring' [error] unit1.pas(xx): not enough actual parameters [fatal error] project1.dpr(5): not compile used unit 'unit1.pas'
could give me tips in how implement "key" , "keybit" option syntax: encrypt := encryptstring('www.website.com'); ?
i appreciate help.
...here code :
..................... ..................... type tkeybit = (kb128, kb192, kb256); ..................... ..................... procedure idmappedporttcp1execute(athread: tidmappedportthread); private { private declarations } public { public declarations } end; implementation function strtohex(const str: ansistring): ansistring; asm push ebx push esi push edi test eax,eax jz @@exit mov esi,edx mov edi,eax mov edx,[eax-4] test edx,edx je @@exit {length(s) = 0} mov ecx,edx push ecx shl edx,1 mov eax,esi {$ifdef ver210} movzx ecx, word ptr [edi-12] {$endif} call system.@lstrsetlength mov eax,esi call uniquestring pop ecx @@sethex: xor edx,edx mov dl, [edi] mov ebx,edx shr edx,4 mov dl,byte ptr[edx+@@hexchar] mov [eax],dl , ebx,$0f mov dl,byte ptr[ebx+@@hexchar] inc eax mov [eax],dl inc edi inc eax loop @@sethex @@exit: pop edi pop esi pop ebx ret @@hexchar: db '0123456789abcdef' end; function encryptstring(value: ansistring; key: ansistring; keybit: tkeybit = kb128): ansistring; var {$ifdef ver210} ss,ds: tmemorystream; {$else} ss, ds: tstringstream; {$endif} size: int64; aeskey128: taeskey128; aeskey192: taeskey192; aeskey256: taeskey256; st: ansistring; begin result := ''; {$ifdef ver210} ss := tmemorystream.create; ss.writebuffer(pansichar(value)^,length(value)); ds := tmemorystream.create; {$else} ss := tstringstream.create(value); ds := tstringstream.create(''); {$endif} try size := ss.size; ds.writebuffer(size, sizeof(size)); if keybit = kb128 begin fillchar(aeskey128, sizeof(aeskey128), 0 ); move(pansichar(key)^, aeskey128, min(sizeof(aeskey128), length(key))); encryptaesstreamecb(ss, 0, aeskey128, ds); end; if keybit = kb192 begin fillchar(aeskey192, sizeof(aeskey192), 0 ); move(pansichar(key)^, aeskey192, min(sizeof(aeskey192), length(key))); encryptaesstreamecb(ss, 0, aeskey192, ds); end; if keybit = kb256 begin fillchar(aeskey256, sizeof(aeskey256), 0 ); move(pansichar(key)^, aeskey256, min(sizeof(aeskey256), length(key))); encryptaesstreamecb(ss, 0, aeskey256, ds); end; {$ifdef ver210} setlength(st,ds.size); ds.position := 0; ds.readbuffer(pansichar(st)^,ds.size); result := strtohex(st); {$else} result := strtohex(ds.datastring); {$endif} ss.free; ds.free; end; end; procedure tform1.idmappedporttcp1execute(athread: tidmappedportthread); var payload, encrypt:string; begin encrypt := encryptstring('www.website.com'); if pos('connect',athread.netdata)<>0 begin if host.text = 'operator' begin athread.outboundclient.write(athread.netdata+#13#10); payload := 'get http://'+encrypt+'/ http/1.1'+#13#10; athread.netdata:= athread.netdata+payload; end; end; end.
cheers, rzv
encryptstring has 2 required , 1 optional parameter. need @ least provide key.
Comments
Post a Comment