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的代码
...
...
... 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的代码
解决方案 »
- 我想在摄像头的预览窗口中,使用鼠标画一个矩形,选中要截取的图像,然后保存图像,怎么实现呢?
- 为什么一使用screen.width,编译器就会死掉?
- 请问怎么监听本机收发的邮件?
- 请一个用VB2008写的,完整的数据库类。
- 100分 VB如何用查找替换的方法批量修改文件名
- 高分:ActiveX 部件不能创建对象
- 关于vsprinter和vsflexgrid导出EXCEL表格的问题..知道的高手请进
- 在vb 中调用vc写的dll时如果函数参数是char *,怎么处理?
- 高分求教!Office Chartspace 控件的使用,急!在线等!!!
- 你说咋办
- 怎么样把打开的记录集都关掉!急啊!
- VB数据库记录删除问题
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