求一加密解密算法:要加密的是些数字类型的东西,我想生成成加密后的东西 原来写了段加密解密算法来着只是生成后有时是一些乱码!谢谢! 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 const C1 = 42845; //加、解密因子一 C2 = 16719; //加、解密因子二function Encrypt(const S: string; Key: Word): string;var I: Integer;begin Result := S; for I := 1 to Length(S) do begin Result[I] := char(byte(S[I]) xor ((Key shr 8) and 127)); Key := (byte(Result[I]) + Key) * C1 + C2; end;end;function Decrypt(const S: string; Key: Word): string;var I: Integer;begin Result := S; for I := 1 to Length(S) do begin Result[I] := char(byte(S[I]) xor ((Key shr 8) and 127)); Key := (byte(S[I]) + Key) * C1 + C2; end;end;//解密时需使用跟加密一样的Key 關於創建及使用臨時表的問題?? HttpCli 问题请教高手解决。 如何导出DLL里的函数原型?? 怎样使用edit的keypress的#13事件来进行对身份证号的验证? 如何开发这样的定义了2层的数据库系统? wang hong mei jiefen wo you wen ti 组态软件的开发中版本,个人陋作,未完成,欢迎指点,有真心朋友需要原码,可以email我 “关于对话框”的问题? 如何在程序运行时自身可以被自己删除! 在delphi中如何建立一个多表的数据库? 请教高手,这是什么错误?(有关数据库) 永别了~~QQ 风流小太狼 请Delphi鸟窝的兄弟帮忙转达
C1 = 42845; //加、解密因子一
C2 = 16719; //加、解密因子二function Encrypt(const S: string; Key: Word): string;
var
I: Integer;
begin
Result := S;
for I := 1 to Length(S) do
begin
Result[I] := char(byte(S[I]) xor ((Key shr 8) and 127));
Key := (byte(Result[I]) + Key) * C1 + C2;
end;
end;function Decrypt(const S: string; Key: Word): string;
var
I: Integer;
begin
Result := S;
for I := 1 to Length(S) do
begin
Result[I] := char(byte(S[I]) xor ((Key shr 8) and 127));
Key := (byte(S[I]) + Key) * C1 + C2;
end;
end;
//解密时需使用跟加密一样的Key