求一个解法,呵呵(75分)

up 一次,
up 二次!

给两分哟!
 
再这样up下去,如果楼主的分数不够分,怎么办?[:D]
 
第一个算法:将字符串所有字符的ASCLL码,在字符的ASCLL码范围内加一个数,该数为字符的位置。
第二个算法:将字符串所有字符的ASCLL码,高4位,低4位分开,别补成两个8位进行存储。[:)]
 
分还多呢,再顶顶
 
算法要看你需要什么难度了,需要一般的话自己随便写个两个公式就可以嘛
比如打乱顺序、加字符等
 
最后一顶,
大家都说说,
每个人都有分啊,
明天揭贴拉......
 
我懒得写代码,up一下吧!
我也是衫菜迷:))))
 
随便写了一下,用了加法加密,应该也不易破解,没认真调试
program Project1;

{$APPTYPE CONSOLE}

uses
SysUtils;

const
Key='TESTNET';
Cryptograph='有些事还是不知为妙';

//不能为0.5,相加为1
Percent1=0.21;
Percent2=0.79;

var
s1:string;
function GetKey(aKey:string;aPercent:Double):string;
var
i:integer;
begin
SetLength(Result,Length(aKey));
for i:=1 to Length(aKey) do
begin
Result:=Chr(Round(Ord(aKey)*aPercent));
end;
end;

function EnCode(aCryptograph,aKey:string):string;
var
i,keylen,codelen:integer;
begin
keylen:=Length(akey);
codelen:=Length(aCryptograph);
SetLength(Result, Length(aCryptograph));
for i:=1 to codelen do
begin
Result:=Chr(Ord(aCryptograph)+Ord(aKey[(i mod KeyLen)+1]));
end;
end;

function DeCode(aCryptograph,aKey:string):string;
var
i,keylen,codelen:integer;
begin
keylen:=Length(akey);
codelen:=Length(aCryptograph);
SetLength(Result, Length(aCryptograph));
for i:=1 to codelen do
begin
Result:=Chr(Ord(aCryptograph)-Ord(aKey[(i mod KeyLen)+1]));
end;
end;

begin
{ TODO -oUser -cConsole Main : Insert code here }

WriteLn('要加密的文字');
WriteLn(Cryptograph);
WriteLn;

WriteLn('密码经过第一个网络');
s1:=EnCode(Cryptograph,GetKey(Key,Percent1));
WriteLn(s1);
WriteLn;

WriteLn('密码经过第二个网络');
s1:=EnCode(s1,GetKey(Key,Percent2));
WriteLn(s1);
WriteLn;

WriteLn('还原');
s1:=DeCode(s1,Key);
WriteLn(s1);
WriteLn;
WriteLn('如果要在VCL控件中显示,还要对#0进行处理,'+
'因为VCL中大部分函数以#0作为结束标记');
ReadLn;
end.
 
请大家看我分配分数是不是很公平呀呵呵
 
不错,笑纳了.
 

Similar threads

回复
0
查看
919
不得闲
S
回复
0
查看
986
SUNSTONE的Delphi笔记
S
S
回复
0
查看
804
SUNSTONE的Delphi笔记
S
顶部