1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: 36: 37: 38: 39: 40: 41: 42: 43: 44: 45: 46: 47: 48: 49: 50: 51: 52: 53: 54: 55: 56: 57: 58: 59: 60: 61: 62: 63: 64: 65: 66: 67: 68: 69: 70: 71: 72: 73: 74: 75: 76: 77: 78: 79: 80: 81: 82: 83: 84: 85: 86: 87: 88: 89:
| unit UnitMain;
interface
uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, Menus, StdCtrls, DCPcrypt2, DCPsha512, DCPblockciphers, DCPcast256;
type TForm1 = class(TForm) MainMenu1: TMainMenu; Datei1: TMenuItem; VerschlsseltSpeichern1: TMenuItem; VerschlsseltSpeichern2: TMenuItem; AlsTextSpeichern1: TMenuItem; Beenden1: TMenuItem; Memo1: TMemo; Cipher: TDCP_cast256; Hash: TDCP_sha512; OpenDialog1: TOpenDialog; SaveDialog1: TSaveDialog; procedure FormCreate(Sender: TObject); procedure VerschlsseltSpeichern2Click(Sender: TObject); procedure SaveSecure(Sender: TObject); private public published end;
var Form1: TForm1; Key, Pressed, ToWrite: String; F: TextFile; implementation
uses UnitPass;
{$R *.dfm}
procedure TForm1.FormCreate(Sender: TObject); begin Pressed := 'Abrechen'; end;
procedure TForm1.VerschlsseltSpeichern2Click(Sender: TObject); begin Form2.Show; end; procedure TForm1.SaveSecure(Sender: TObject); var I: Integer; begin If FileExists(SaveDialog1.FileName) then Begin if (Application.MessageBox('Datei existiert, soll es überschrieben werden??', 'Achtung!', mb_YesNo) = idYes) then begin AssignFile(F, SaveDialog1.FileName); Rewrite(F); Cipher.InitStr(Key, TDCP_SHA512); For I:=0 to Memo1.Lines.Count -1 do begin ToWrite := Cipher.EncryptString(Memo1.Lines[i]); WriteLn(F, ToWrite); end; Cipher.Burn; Cipher.Free; CloseFile(F); end; end else begin AssignFile(F, SaveDialog1.FileName); ReWrite(F); Cipher.InitStr(Key, TDCP_SHA512); For I:=0 to Memo1.Lines.Count - 1 do Begin ToWrite := Cipher.EncryptString(Memo1.Lines[I]); WriteLn(F, ToWrite); end; Cipher.Burn; Cipher.Free; CloseFile(F); end; end;
end. |