如题我是新人一个,所以实在是不会搞~~  求各位大哥帮帮忙吧~
转换到DELPHI 的单元~
.版本 2.子程序 转换RC4解密
.参数 instr, 文本型
.参数 key, 文本型, 可空
.局部变量 临时, 字节型, , "0"
.局部变量 s, 字节型, , "256"
.局部变量 k, 字节型, , "256"
.局部变量 i
.局部变量 j
.局部变量 y
.局部变量 outstr, 字节型, , "0"
.局部变量 temp, 字节型
.局部变量 x, 整数型
.局部变量 t, 整数型
.局部变量 计次, 整数型instr = 子文本替换 (instr, “,”, , , , 真)
.变量循环首 (1, 取文本长度 (instr), 2, 计次)
    加入成员 (临时, 到字节 (转换十六到十 (取文本中间 (instr, 计次, 2))))
.变量循环尾 ()
.计次循环首 (256, i)
    s [i] = i - 1
.计次循环尾 ()
j = 1
.计次循环首 (256, i)
    .如果真 (j > 取文本长度 (key))
        j = 1
    .如果真结束
    k [i] = 取代码 (取文本中间 (key, j, 1), )
    j = j + 1
.计次循环尾 ()
j = 0
.计次循环首 (256, i)
    j = (j + s [i] + k [i]) % 256 + 1
    temp = s [i]
    s [i] = s [j]
    s [j] = temp
.计次循环尾 ()
i = 0
j = 0
.计次循环首 (取数组成员数 (临时), x)
    i = (i + 1) % 256 + 1
    j = (j + s [i]) % 256 + 1
    temp = s [i]
    s [i] = s [j]
    s [j] = temp
    t = (s [i] + s [j] % 256) % 256 + 1
    y = s [t]
    加入成员 (outstr, 位异或 (临时 [x], y))
.计次循环尾 ()
使用密码 = 到整数 (到文本 (outstr))

解决方案 »

  1.   

    为什么  同样是 RC4加密     
    delphi  的加密结果就和  易语言的加密结果不一样呢?
      

  2.   

    依照楼上的  我把他传在这里了
    http://www.lhaol.com/易语言.rar
      

  3.   

    如果有谁可以的话我可以人民币求助~  [email protected]
      

  4.   

    这是一种RC4加密方式,不过是经过变形的了,我这有一份delphi的RC4源码,帮我改一下把~~unit Unit2;interfacetype
    PByteArray = ^TByteArray;
    TByteArray = Array [0..32767] Of Byte;TRC4 = class
    private
    D : array[Byte] of Byte;
    I,J : Byte;
    procedure Init(const Key: string);
    procedure Done;
    procedure Code(Source, Dest: pChar; Count: Integer);
    public
    function Encrypt(S: pChar; const Password: string): AnsiString;
    function Decrypt(S: pChar; const Password: string): AnsiString;
    end;implementation{ TRC4.Encrypt
    This function will return the text(S) encrypted with the chosen password. }
    function TRC4.Encrypt(S: pChar; const Password: string): AnsiString;
    begin
    SetLength(Result, Length(S));
    Init(Password);
    Code(pChar(S), pChar(Result), Length(S));
    Done;
    end;{ TRC4.Decrypt
    This function will return the text(S) decrypted with the chosen password. }
    function TRC4.Decrypt(S: pChar; const Password: string): AnsiString;
    begin
    SetLength(Result, Length(S));
    Init(Password);
    Code(pChar(S), pChar(Result), Length(S));
    Done;
    end;{ TRC4.Init
    This routine will prepare the encryption/decryption. }
    procedure TRC4.Init(const Key: string);
    var
    R, S, T, K : Byte;
    U,L : Integer;
    DummyArray : array [0..1599] of Char;
    begin
    {$R-}
    {$Q-}
    L := Length(Key);
    I := 0;
    J := 0;
    R := 0;
    U := 0;
    for S := 0 to 255 do
    D[S] := S;
    for S := 0 to 255 do
    begin
    if (U < L) then
    K := PByteArray(Key)[u]
    else
    K := 0;
    Inc(U);
    if (U >= L) then
    U := 0;
    Inc(R, D[S] + K);
    T := D[S];
    D[S] := D[R];
    D[R] := T;
    end;
    Code(@DummyArray, @DummyArray, 1600);
    end;{ TRC4.Done
    This routine will clean the variables used when encrypting/decrypting. }
    procedure TRC4.Done;
    begin
    FillChar(D, sizeOf(D), 0);
    FillChar(I, sizeOf(I), 0);
    FillChar(J, sizeOf(J), 0);
    end;{ TRC4.Code
    This routine will encrypt the text. }
    procedure TRC4.Code(Source, Dest: pChar; Count: Integer);
    var
    S : Integer;
    T : Byte;
    begin
    for S := 0 to (Count - 1) do
    begin
    Inc(I);
    T := D[i];
    Inc(J, T);
    D[i] := D[J];
    D[J] := T;
    Inc(T, D[i]);
    Byte(Dest[S]) := Byte(Source[S]) xor D[T];
    end;
    end;end.__________________
      

  5.   

    额我知道易语言远远不如DELPHI强大,可是它的好处就是简单易学  现在想要变成delphi的我这个菜鸟级别不行啊 需要一个例子~~