全國最多中醫師線上諮詢網站-台灣中醫網
發文 回覆 瀏覽次數:1026
推到 Plurk!
推到 Facebook!

有關aes的問題?是之前有人發問過的問題。不好意思,我是新手,想學

答題得分者是:wameng
paa
初階會員


發表:50
回覆:101
積分:30
註冊:2005-02-01

發送簡訊給我
#1 引用回覆 回覆 發表時間:2005-04-29 20:25:40 IP:163.28.xxx.xxx 未訂閱
unit Unit1; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls; type TForm1 = class(TForm) Edit1: TEdit; Edit2: TEdit; Edit3: TEdit; Button1: TButton; procedure Button1Click(Sender: TObject); private { Private declarations } public { Public declarations } end; var Form1: TForm1; const StartKey = 981; {Start default key} MultKey = 12674; {Mult default key} AddKey = 35891; {Add default key} function Encrypt(const InString:string; StartKey,MultKey,AddKey:Integer): string; function Decrypt(const InString:string; StartKey,MultKey,AddKey:Integer): string; implementation {$R-} {$Q-} {******************************************************* * Standard Encryption algorithm - Copied from Borland * *******************************************************} function Encrypt(const InString:string; StartKey,MultKey,AddKey:Integer): string; var I : Byte; begin Result := ''; for I := 1 to Length(InString) do begin Result := Result CHAR(Byte(InString[I]) xor (StartKey shr 8)); StartKey := (Byte(Result[I]) StartKey) * MultKey AddKey; end; end; {******************************************************* * Standard Decryption algorithm - Copied from Borland * *******************************************************} function Decrypt(const InString:string; StartKey,MultKey,AddKey:Integer): string; var I : Byte; begin Result := ''; for I := 1 to Length(InString) do begin Result := Result CHAR(Byte(InString[I]) xor (StartKey shr 8)); StartKey := (Byte(InString[I]) StartKey) * MultKey AddKey; end; end; {$R } {$Q } procedure TForm1.Button1Click(Sender: TObject); var s:string; begin s:=Encrypt(edit1.text,38383,383838,383838); edit2.text:=s; edit3.text:=Decrypt(s,38383,383838,383838); end; end. 我想問的是怎麼跑的時候出現project project1.exe raised exception class EResNotFound with message'Resource TForm1 not found'.process stopped.use stepor Run to continue. 在button那,edit2後面的38383,383838,383838是指什麼意思啊?
wameng
版主


發表:31
回覆:1336
積分:1188
註冊:2004-09-16

發送簡訊給我
#2 引用回覆 回覆 發表時間:2005-04-29 20:46:59 IP:61.31.xxx.xxx 未訂閱
1. 在implementation 下,少了定義表單。 implementation {$R *.DFM} <--- 加入此行 2.Encrypt(edit1.text,38383,383838,383838); 383838,383838,383838可以隨自己定義。 類似加密的種子,依據此參數加密或解密。 只不過一般都用亂數產生這三個數值。 讓每次加密後的文字均不相同。
系統時間:2024-06-08 2:14:05
聯絡我們 | Delphi K.Top討論版
本站聲明
1. 本論壇為無營利行為之開放平台,所有文章都是由網友自行張貼,如牽涉到法律糾紛一切與本站無關。
2. 假如網友發表之內容涉及侵權,而損及您的利益,請立即通知版主刪除。
3. 請勿批評中華民國元首及政府或批評各政黨,是藍是綠本站無權干涉,但這裡不是政治性論壇!