function DenCrypt(Str : string; Key : string): string; var X, Y : Integer; A : Byte; begin if Key = '' then Key := '123456'; Y := 1; for X := 1 to length(Str) do begin A := (ord(Str[X]) and $0f) xor (ord(Key[Y]) and $0f); Str[X] := char((ord(Str[X]) and $f0) + A); inc(Y); if Y > length(Key) then Y := 1; end; Result := Str; end;
解决方案 »
- delphi与C++数据类型转换以及pointer类型的问题
- Delphi三层主从表巢状结构分段取数据问题
- DBGRID的老问题!~~~~
- IdTCPClient如何接收数据,各位英雄来看看!!!
- 逻辑分离中界面和业务单元是一对一的吗?
- 有关 ListView 控件 ,鼠标拖动多选的问题
- Incompatible types: 'Word2000.TWordApplication' and 'WordXP.TWordApplication'
- 请问怎么将彩票29选7的所有组合都显示出来
- 菜鸟问题:Owner属性和Parent属性有什么区别?各有什么作用?
- 在一行的结尾为什么没有回车键????
- 一段小程序看不懂,大家帮忙看看
- 各位朋友,我知道你们只关心技术,其实我也一样
int X,Y; byte A; StringBuffer SF;
if (Key="")
Key="123456";
Y=1;
for(X=1;X<Str.length();X++){
A=(Str.charAt(X) & 0Xf) ^(Key.charAt(Y) & 0Xf);
SF=new StringBuffer(Str);
SF.setCharAt(X,(char)(Str.charAt(X) & 0Xf0)+A));
Str:=SF.toString;
Y++;
if Y > length(Key) then
Y := 1;
if (Y>Key.length())
Y=1;
}
return Str;
}
呼好累,大体应该没有错了。
东方不败不就是咱们的祖师爷?
2.字符串比较不能用= 而应该用 Str.compareTo()
3.赋值要用 = 而不是 := //我相信这个是打错了!