DESEncryptStrToHex算法同1个字符串返回值的值不一样
DESEncryptStrToHex算法同1个字符串,多次调用返回值的值不一样
?CnDES.pas文件的修改日期为:2020?年?4?月?1?日,??14:46:10(github上最新版本)
Embarcadero? Delphi 10.3 Version 26.0.36039.7899 (Delphi10.3.3 )
现像描述:
1.Form上放置Edit1、Button1、Memo1三个控件。
2.Button1Click中调用DESEncryptStrToHex计算。
3.DESEncryptStrToHex的参数说明:Str=‘’;Key = '{F59DE24F-E882-4117-A46E-B474DA65AB11}'。
4.返回值如下:(PW为参数Str;AESKey为参数Key;sOpPW为函数返回值)
-----------------------------------按Button1前,焦点在Edit1
PW:
AESKey:{F59DE24F-E882-4117-A46E-B474DA65AB11}
sOpPW:904E5A043CAA4800
-----------------------------------按Button1前,焦点在Button1
PW:
AESKey:{F59DE24F-E882-4117-A46E-B474DA65AB11}
sOpPW:500057003A000D00
-----------------------------------按Button1前,焦点在Memo1
PW:
AESKey:{F59DE24F-E882-4117-A46E-B474DA65AB11}
sOpPW:60D558043CAA4800
上面就得到了3个不一样的返回值。
下面为完整的pas文件内容:
unit Unit1;
interface
uses
Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls;
type
TForm1 = class(TForm)
Edit1: TEdit;
Button1: TButton;
Memo1: TMemo;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
uses CnDES;
const
AESKey = '{F59DE24F-E882-4117-A46E-B474DA65AB11}';
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
var
sOpPW,pw:AnsiString;
begin
//pw := Trim(Edit1.Text);
pw := '';
sOpPW := DESEncryptStrToHex(pw,AESKey);
Memo1.Lines.Append('-----------------------------------');
Memo1.Lines.Append('PW:'+Trim(Edit1.Text));
Memo1.Lines.Append('AESKey:'+AESKey);
Memo1.Lines.Append('sOpPW:'+sOpPW);
end;
end.
[ 本帖最后由 wfymqj 于 2020-7-22 15:36 编辑 ]
|