Ich habe ein Programm geschrieben, welches Kryptographische Schlüssel erstellen kann und Dateien danach ver- und entschlüsseln kann. Das Programm benutzt btools_requester.dll.
Entweder als Download auf meiner HP (unter Downloads/CGKrypt.zip)
CGKrypt
Oder als
Source (etwas unübersichtlich, da ich alle includes reinkopiert habe und dadurch die Formatierung verloren gegangen ist):
BlitzBasic: [AUSKLAPPEN] [EINKLAPPEN]
Repeat
Print "Kryptografisches Verschlüsselungsprogramm by Christian Geißler" Print Print "Choose:" Print Print "Press nr 1 to create a new Key" Print "Press nr 2 to Code a File" Print "Press nr 3 to Decode a File"
SetBuffer BackBuffer()
Repeat If KeyHit(1) End If KeyHit (2) debug=1
Cls FlushKeys Print "Verschlüsselungsgrad wählen (um so höher die Zahlen, um so größer wird der Schlüssel)" Print "Info: Die folgenden Eingaben werden Multipliziert und daraus ergibt sich der Sicherheitsgrad in Zeichen" Print "Wenn man 4 Ziffern um die 20 Nimmt bekommt man schon einen recht großen Schlüssel, der sehr lange dauert" Print "erstellt zu werden (ca 1 Stunde). Meistens reicht es, die Primzahlen 2,3,5 und 7 als Verschlüsselung an zu geben." Print trommel1=Input("Irgend eine Zahl: ") trommel2=Input("Irgend eine Primzahl (z.B. 2): ") trommel3=Input("Irgend eine andere Primzahl (z.B. 3): ") trommel4=Input("Irgend eine andere Primzahl (z.B. 5): ")
AscIIzeichenanzahl=255
Fortschritt#=0 gesammt#=(trommel1+1)*(trommel2+1)*(trommel3+1)*(trommel4+1)
Dim codec(trommel1,trommel2,trommel3,trommel4,AscIIzeichenanzahl)
SeedRnd MilliSecs() For i=0 To trommel1 For i2=0 To trommel2 For i3=0 To trommel3 SeedRnd MilliSecs() For i4=0 To trommel4
Cls Text 10,10,"Fortschritt: "+(Fortschritt/gesammt)*100 Text 10,30,"trommel1: "+i Text 10,40,"trommel2: "+i2 Text 10,50,"trommel3: "+i3 Text 10,60,"trommel4: "+i4 Text 10,80,"Sicherheit des Schlüssels: "+gesammt+" Zeichen" Flip
Fortschritt=Fortschritt+1 For aktuelles_Zeichen=0 To AscIIzeichenanzahl
Repeat zs=Rand(0,AscIIzeichenanzahl)
bit=0 For iz=0 To aktuelles_Zeichen-1 If codec(i,i2,i3,i4,iz)=zs bit=1 Next
Until bit=0
codec(i,i2,i3,i4,aktuelles_Zeichen)=zs
Next Next
Next Next Next
Cls Text 10,10, "Codeschlüssel erstellt."
outputstream=WriteFile (BTSaveFile("Speichern der Verschlüsselten Datei",CurrentDir(),".cgk"))
WriteByte outputstream,trommel1 WriteByte outputstream,trommel2 WriteByte outputstream,trommel3 WriteByte outputstream,trommel4 WriteByte outputstream,AscIIzeichenanzahl
For i=0 To trommel1 For i2=0 To trommel2 For i3=0 To trommel3 For i4=0 To trommel4 For aktuelles_Zeichen=0 To AscIIzeichenanzahl WriteByte outputstream,codec(i,i2,i3,i4,aktuelles_Zeichen) Next Next Next Next Next WriteString outputstream,"end." CloseFile outputstream Cls Text 10,10,"Schlüssel gespeichert" Ende=1 ElseIf KeyHit(3)
keystream=OpenFile(BTLoadFile("Schlüssel",CurrentDir(),".txt")) trommel1=ReadByte(keystream) trommel2=ReadByte(keystream) trommel3=ReadByte(keystream) trommel4=ReadByte(keystream) AscIIzeichenanzahl=ReadByte(keystream)
Dim codec(trommel1,trommel2,trommel3,trommel4,AscIIzeichenanzahl)
For i=0 To trommel1 For i2=0 To trommel2 For i3=0 To trommel3 For i4=0 To trommel4 For aktuelles_Zeichen=0 To AscIIzeichenanzahl codec(i,i2,i3,i4,aktuelles_Zeichen)=ReadByte (keystream) Next Next Next Next Next
CloseFile keystream
inputstream=OpenFile(BTLoadFile("Quelldatei",CurrentDir(),".txt")) outputstream=WriteFile(BTSaveFile("Speichern der Verschlüsselten Datei",CurrentDir(),""))
trommel1zs=0 trommel2zs=0 trommel3zs=0 trommel4zs=0
Repeat
trommel1zs=(trommel1zs+1) Mod trommel1 trommel2zs=(trommel2zs+1) Mod trommel2 trommel3zs=(trommel3zs+1) Mod trommel3 trommel4zs=(trommel4zs+1) Mod trommel4
aktuelles_byte=ReadByte (Inputstream) WriteByte outputstream,codec(trommel1zs,trommel2zs,trommel3zs,trommel4zs,aktuelles_byte)
Until Eof(Inputstream)
CloseFile Inputstream CloseFile outputstream
Cls Text 10,10,"Codierung war erfolgreich" Flip Ende=1 ElseIf KeyHit(4) keystream=OpenFile(BTLoadFile("Schlüssel",CurrentDir(),".txt")) trommel1=ReadByte(keystream) trommel2=ReadByte(keystream) trommel3=ReadByte(keystream) trommel4=ReadByte(keystream) AscIIzeichenanzahl=ReadByte(keystream)
Dim codec(trommel1,trommel2,trommel3,trommel4,AscIIzeichenanzahl)
For i=0 To trommel1 For i2=0 To trommel2 For i3=0 To trommel3 For i4=0 To trommel4 For aktuelles_Zeichen=0 To AscIIzeichenanzahl codec(i,i2,i3,i4,aktuelles_Zeichen)=ReadByte (keystream) Next Next Next Next Next
CloseFile keystream
inputstream=OpenFile(BTLoadFile("Verschlüsselte Quelldatei",CurrentDir(),".txt")) outputstream=WriteFile(BTSaveFile("Speichern der Entschlüsselten Datei",CurrentDir(),""))
trommel1zs=0 trommel2zs=0 trommel3zs=0 trommel4zs=0
Repeat
trommel1zs=(trommel1zs+1) Mod trommel1 trommel2zs=(trommel2zs+1) Mod trommel2 trommel3zs=(trommel3zs+1) Mod trommel3 trommel4zs=(trommel4zs+1) Mod trommel4
aktuelles_byte=ReadByte (Inputstream) For i=0 To AscIIzeichenanzahl If codec(trommel1zs,trommel2zs,trommel3zs,trommel4zs,i)=aktuelles_byte zs=i Next WriteByte outputstream,zs
Until Eof(Inputstream)
CloseFile Inputstream CloseFile outputstream
Cls Text 10,10,"Decodierung war erfolgreich" Flip Ende=1 EndIf Until Ende=1
Repeat Cls Text 10,10,"Beenden: Esc " Text 10,20,"Weiter: Enter" Flip If KeyHit(1) End Until KeyHit(28)
Forever
nicht vergessen: Man benötigt die btools_requester.dll
Wenn man sich die Exe direkt von meiner HP saugt, ist die dll schon dabei.
(P.s.: Ich weis dass meine HP total hässlich ist, aber das ist mir egal. Sie dient nur zum lagern meiner Daten und zum verteilen, und nicht zum präsentieren)
|