delphi 的代码如下:
...
...
...   const
  fSeedA = 56789 ;///  常量 ,  
  fSeedB = 54667 ; ///  常量 ,  
  fKey=7744 ;  //  钥匙
var
  Form1: TForm1;implementation{$R *.dfm}function Encrypt(const str: string): string;
var
  i, j, iKey: Integer;
  strGet: string;
begin
  strGet := str;
  iKey := FKey;
  Result := strGet;
  for i := 1 to Length(strGet) do
  begin
    Result[i] := Char(byte(strGet[i])xor(iKey shr 8));
    iKey := (Byte(Result[I]) + iKey) * FSeedA + FSeedB;
  end;
  strGet := Result;
  Result := '';
  for i := 1 to Length(strGet) do
  begin
    j := Integer(strGet[i]);
    Result := Result + Char(65+(j div 26))+ char(65+(j mod 26));
  end;
end;function  Decrypt(const str: string): string;
var
  i, j, iKey: Integer;
  strGet: string;
begin
  strGet := str;
  iKey := FKey;
  Result := '';
  for i := 1 to (Length(strGet) div 2) do
  begin
    j := (Integer(strGet[2*i-1])-65)*26;
    j := j + (Integer(strGet[2*i])-65);
    Result := Result + Char(j);
  end;
  strGet := Result;
  for i := 1 to Length(strGet) do
  begin
    Result[i] := Char(byte(strGet[I]) xor (iKey shr 8));
    iKey := (Byte(strGet[I]) + iKey) * FSeedA + FSeedB;
  end;
end;请各位把这段delphi写的字符串加密和解密函数转成VB6的代码

解决方案 »

  1.   

    还没有学过delphi看起来都困难,顶!
      

  2.   

    偶正在学  delphi   帮你up吧
      

  3.   

    你这个有点像 crc16 的算法,不过vb中没有直接位移的运算,需要测试,麻烦。
      

  4.   

    const  fSeedA = 56789 ';///  常量 ,  
    const  fSeedB = 54667 '; ///  常量 ,  
    const  fKey=7744 ;  '//  钥匙
    dim Form1 as TForm1function Encrypt(str as string)as string;
    dim i as integer, j as integer, iKey as Integer;
    dim strGet as string;
      strGet = str
      iKey = FKey
      Result = strGet
      for i = 1 to Length(strGet)
        Result(i) = Char(byte(strGet(i))xor(iKey shr 8))
        iKey = (Byte(Result(I)) + iKey) * FSeedA + FSeedB
    next i
      strGet = Result
      Result = ""
      for i = 1 to Length(strGet) 
        j = Integer(strGet(i))
        Result = Result + Char(65+(j div 26))+ char(65+(j mod 26))
     next i
    end functionfunction  Decrypt(str as string)as string;
    dim i as integer, j as integer, iKey as Integer;
    dim   strGet as string;
      strGet = str
      iKey = FKey
      Result = ""
      for i = 1 to (Length(strGet) mode 2)
        j = (Integer(strGet(2*i-1))-65)*26
        j = j + (Integer(strGet(2*i))-65)
        Result = Result + Char(j)
    next i
      strGet = Result
      for i = 1 to Length(strGet)
        Result(i) = Char(byte(strGet(I)) xor (iKey shr 8))
        iKey = (Byte(strGet(I)) + iKey) * FSeedA + FSeedB
    next i
    end function