我记得在CSDN中看到过一个叫AES的加密算法把。可是我把它弄丢了。
再找不到了。
好像这个算法的压缩包里面,有一个繁体中文的DEMO
谁能帮忙找到,高分相送~~~
再找不到了。
好像这个算法的压缩包里面,有一个繁体中文的DEMO
谁能帮忙找到,高分相送~~~
解决方案 »
- delphi判断edit框里输入的是否为IP地址
- listview 图标的问题
- 提供做任意查询生成器的思想!
- 请问如何在delphi中调用html help 做的帮助.chm文件?请给出代码?谢谢!
- 我想将treeview的一个节点下的所有子节点拖动到另外一个节点下面
- 安装.net出错,怎么办?急!
- 关于dbgrideh,看一下啦??????????
- SQLServer中,如何锁定某个表或表中的某记录,不让其他程序读写。。。
- 今晚有多少人想通宵, 通宵者有分
- ?在orical数据库中如何用delphi存储jpg图象!!jpg图象是文件的形式!!!急!!!!!!
- 实现动态创建窗体
- 指针(Pointer)和引用(Reference)的区别!!!!
aes不太清楚..
帮你up..
uses Classes, Math, SysUtils;function Encrypt(s, Pwd: string): string;
function Decrypt(s, Pwd: string): string;implementationuses ElAES;function Encrypt(s, Pwd: string): string;
function StringToHex(S: string): string;
var i: integer;
Begin
Result := '';
for i := 1 to Length( S ) do
Result := Result + IntToHex( Ord( S[i] ), 2 );
end;
var
Source: TStringStream;
Dest: TStringStream;
Size: integer;
Key: TAESKey128;begin
Source := TStringStream.Create( S );
Dest := TStringStream.Create( '' );
try
Size := Source.Size;
Dest.WriteBuffer( Size, SizeOf(Size) );
FillChar( Key, SizeOf(Key), 0 );
Move( PChar( Pwd )^, Key, Min( SizeOf( Key ), Length( Pwd )));
EncryptAESStreamECB( Source, 0, Key, Dest );
Result:= StringToHex( Dest.DataString ); finally
Source.Free;
Dest.Free;
end;
end;function Decrypt(s, Pwd: string): string;
function HexToString(S: string): string;
var i: integer;
Begin
Result := '';
for i := 1 to Length( S ) do
begin
if ((i mod 2) = 1) then
Result := Result + Chr( StrToInt( '0x' + Copy( S, i, 2 )));
end;
end;
var
Source: TStringStream;
Dest: TStringStream;
Size: integer;
Key: TAESKey128;begin
Source := TStringStream.Create( HexToString( s ));
Dest := TStringStream.Create( '' ); try
Size := Source.Size;
Source.ReadBuffer(Size, SizeOf(Size));
FillChar(Key, SizeOf(Key), 0);
Move(PChar( Pwd )^, Key, Min(SizeOf(Key), Length( Pwd )));
DecryptAESStreamECB(Source, Source.Size - Source.Position, Key, Dest);
Result := Dest.DataString;
finally
Source.Free;
Dest.Free;
end;
end;end.
能不能发给我,我收到后立刻结分~~
要把DEMO也发给我~谢谢~`