这两个函数是用来简单的解密某一个字符串的,现在想在后台ORACLE数据库中实现它,但是两边对应的函数类型不熟悉,遇到困难,求教高手指点,不胜感激啊...
//16进制字符串转换成字符串
function Tform1.HexStrToStr(const S:string):string;
var
t:Integer;
ts:string;
M,Code:Integer;
begin
t:=1;
Result:='';
while t<=Length(S) do
begin
while not (S[t] in ['0'..'9','A'..'F','a'..'f']) do
inc(t);
if (t+1>Length(S))or(not (S[t+1] in ['0'..'9','A'..'F','a'..'f'])) then
ts:='$'+S[t]
else
ts:='$'+S[t]+S[t+1];
Val(ts,M,Code);
if Code=0 then
Result:=Result+Chr(M);
inc(t,2);
end;
end;//异或字符串
function Tform1.XorStr(const S:string):string;
const
aXorChar:array [0..2] of Byte =(3,9,15);
var
I:Integer;
begin
SetLength(Result,Length(S));
for I:=1 to Length(S) do
begin
Result[I]:=Char(Ord(S[I]) Xor aXorChar[I mod (High(aXorChar)+1)]);
end;
end;
//16进制字符串转换成字符串
function Tform1.HexStrToStr(const S:string):string;
var
t:Integer;
ts:string;
M,Code:Integer;
begin
t:=1;
Result:='';
while t<=Length(S) do
begin
while not (S[t] in ['0'..'9','A'..'F','a'..'f']) do
inc(t);
if (t+1>Length(S))or(not (S[t+1] in ['0'..'9','A'..'F','a'..'f'])) then
ts:='$'+S[t]
else
ts:='$'+S[t]+S[t+1];
Val(ts,M,Code);
if Code=0 then
Result:=Result+Chr(M);
inc(t,2);
end;
end;//异或字符串
function Tform1.XorStr(const S:string):string;
const
aXorChar:array [0..2] of Byte =(3,9,15);
var
I:Integer;
begin
SetLength(Result,Length(S));
for I:=1 to Length(S) do
begin
Result[I]:=Char(Ord(S[I]) Xor aXorChar[I mod (High(aXorChar)+1)]);
end;
end;
解决方案 »
- 刚接触DELPHI,如何学习报表?
- Oracle下图像的存取
- 我在登录窗体上使用IMAGE控件来放置一个图标,程序每次运行都要去找这个图标文件,请问如果将这个图标打到文件里?
- 问一下:做一款网络游戏需要具备怎样的知识结构啊???
- 如何得到form上其他控件更名的通知?
- 如何在程序运行的时候往Image组件中载入jpg图像?
- ******select返回的结果问题***********
- 如何用Insert Into语句向Access数据库中添加含有Memo类型字段的记录?
- 关于SMTP认证的问题
- 是不是因为我不够温柔,你才会离我远走?
- 为什么调用TWindowsMediaPlayer控件的newMedia()方法的时候会出错?
- AdoQuery或者打taset有没有实现象select distinct功能的方法
我自己也在试写。