Ich wollte ein kleines Programm schreiben, das einen Text ver- bzw. entschlüsselt.
Vom Prinzip liest sich das nicht schwer in der Hilfe, ich komme jedoch nicht weiter.
AutoIt
#AutoIt3Wrapper_Au3Check_Parameters=-q -d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6 -w 7
#include <Crypt.au3>
#include <MsgBoxConstants.au3>
Global $Eingabe, $Richtung
While 1
$Eingabe = InputBox('String', 'Type in the string: ', ClipGet(), '')
If @error Then Exit
$Richtung = MsgBox($MB_YESNO, 'Encode or Decode', 'Do you want to encode the string?')
If @error Then Exit
If StringLen($Eingabe) > 0 Then
Doit()
Else
Exit
EndIf
WEnd
Func Doit()
Local $vCryptKey
$vCryptKey = _Crypt_DeriveKey(StringToBinary('EinKryptischerString'), $CALG_AES_256)
_Crypt_Startup()
if $Richtung = $IDYES then ;Verschlüsseln
$Eingabe = _Crypt_EncryptData ($Eingabe, $vCryptKey, $CALG_USERKEY)
ElseIf $Richtung = $IDNO then ;Entschlüsseln
$Eingabe = _Crypt_DecryptData ($Eingabe, $vCryptKey, $CALG_USERKEY)
$Eingabe = BinaryToString($Eingabe)
EndIf
ClipPut($Eingabe)
MsgBox($MB_SYSTEMMODAL, "", "The following data is stored in the clipboard: " & @CRLF & $Eingabe)
_Crypt_DestroyKey($vCryptKey) ; Destroy the cryptographic key.
_Crypt_Shutdown() ; Shutdown the crypt library.
Exit
EndFunc
Alles anzeigen
Problem dabei ist nun, das der verschlüsselte String nicht wieder richtig entschlüsselt wird. Was mache ich falsch?
Offtopic: Beim Thema erstellen in diesem Bereich viel mir auf das er oben links als Bereich (Abkürzung) "HundÜ" anzeigt, müsste aber "HundU" sein