#cs ----------------------------------------------------------------------------

 AutoIt Version: 3.3.6.1
 Author:         Frithjof Pollmüller

 Script Function:
	Verschlüsslungssoftware

#ce ----------------------------------------------------------------------------

; Script Start - Add your code below here

#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <Math.au3>
#include <Array.au3>
#Include <GuiEdit.au3>
#include <GuiConstantsEx.au3>



Global Const $FLT_EPSILON = _GET_FLT_EPSILON()

#Region ### START Koda GUI section ### Form=c:\users\frithjof\desktop\autoitprojekte\koda\forms\fritkrypt.kxf
$Form1_1 = GUICreate("FritKrypt v0.1 by Frithjof P.", 774, 790, 254, 118)
$Eingabe = GUICtrlCreateEdit("", 8, 13, 490, 377, BitOR($ES_AUTOVSCROLL,$ES_WANTRETURN,$WS_VSCROLL ))





GUICtrlSetData(-1, "Eingabe")
$Ausgabe = GUICtrlCreateEdit("", 8, 432, 482, 337, BitOR($ES_AUTOVSCROLL,$ES_READONLY,$WS_VSCROLL))
GUICtrlSetData(-1, "Ausgabe")
$Input1 = GUICtrlCreateInput("F(X)", 520, 16, 241, 21)
$Label1 = GUICtrlCreateLabel("Ver-/Entschlüsslungsfunktion", 520, 40, 142, 17)
$Button1 = GUICtrlCreateButton("Verschlüsseln", 512, 736, 105, 41)
$Button2 = GUICtrlCreateButton("Entschlüsseln", 624, 736, 105, 41)
$Label2 = GUICtrlCreateLabel("Buchstabenzuweisung", 520, 72, 214, 28)
GUICtrlSetFont(-1, 14, 800, 4, "MS Sans Serif")
$Labela = GUICtrlCreateLabel("A:", 520, 104, 14, 17)
$Labelb = GUICtrlCreateLabel("B:", 520, 124, 14, 17)
$Labelc = GUICtrlCreateLabel("C:", 520, 144, 14, 17)
$Labeld = GUICtrlCreateLabel("D:", 520, 164, 15, 17)
$Labele = GUICtrlCreateLabel("E:", 520, 184, 14, 17)
$Labelf = GUICtrlCreateLabel("F:", 520, 204, 13, 17)
$Labelg = GUICtrlCreateLabel("G:", 520, 224, 15, 17)
$Labelh = GUICtrlCreateLabel("H:", 520, 244, 15, 17)
$Labeli = GUICtrlCreateLabel("I:", 520, 264, 10, 17)
$Labelj = GUICtrlCreateLabel("J:", 520, 284, 12, 17)
$Labelk = GUICtrlCreateLabel("K:", 520, 304, 14, 17)
$Labell = GUICtrlCreateLabel("L:", 520, 324, 13, 17)
$Labelm = GUICtrlCreateLabel("M:", 520, 344, 16, 17)
$Labeln = GUICtrlCreateLabel("N:", 520, 364, 15, 17)
$Labelo = GUICtrlCreateLabel("O:", 520, 384, 15, 17)
$Labelp = GUICtrlCreateLabel("P:", 520, 404, 14, 17)
$Labelq = GUICtrlCreateLabel("Q:", 520, 424, 15, 17)
$Labelr = GUICtrlCreateLabel("R:", 520, 444, 15, 17)
$Labels = GUICtrlCreateLabel("S:", 520, 464, 14, 17)
$Labelt = GUICtrlCreateLabel("T:", 520, 484, 14, 17)
$Labelu = GUICtrlCreateLabel("U:", 520, 504, 15, 17)
$Labelv = GUICtrlCreateLabel("V:", 520, 524, 14, 17)
$Labelw = GUICtrlCreateLabel("W:", 520, 544, 18, 17)
$Labelx = GUICtrlCreateLabel("X:", 520, 564, 14, 17)
$Labely = GUICtrlCreateLabel("Y:", 520, 584, 14, 17)
$Labelz = GUICtrlCreateLabel("Z:", 520, 604, 14, 17)
$Label3 = GUICtrlCreateLabel("xxxxx", 560, 104, 29, 17)
$Label4 = GUICtrlCreateLabel("xxxxx", 560, 124, 29, 17)
$Label5 = GUICtrlCreateLabel("xxxxx", 560, 144, 29, 17)
$Label6 = GUICtrlCreateLabel("xxxxx", 560, 164, 29, 17)
$Label7 = GUICtrlCreateLabel("xxxxx", 560, 184, 29, 17)
$Label8 = GUICtrlCreateLabel("xxxxx", 560, 204, 29, 17)
$Label9 = GUICtrlCreateLabel("xxxxx", 560, 224, 29, 17)
$Label10 = GUICtrlCreateLabel("xxxxx", 560, 244, 29, 17)
$Label11 = GUICtrlCreateLabel("xxxxx", 560, 264, 29, 17)
$Label12 = GUICtrlCreateLabel("xxxxx", 560, 284, 29, 17)
$Label13 = GUICtrlCreateLabel("xxxxx", 560, 304, 29, 17)
$Label14 = GUICtrlCreateLabel("xxxxx", 560, 324, 29, 17)
$Label15 = GUICtrlCreateLabel("xxxxx", 560, 344, 29, 17)
$Label16 = GUICtrlCreateLabel("xxxxx", 560, 364, 29, 17)
$Label17 = GUICtrlCreateLabel("xxxxx", 560, 384, 29, 17)
$Label18 = GUICtrlCreateLabel("xxxxx", 560, 404, 29, 17)
$Label19 = GUICtrlCreateLabel("xxxxx", 560, 424, 29, 17)
$Label20 = GUICtrlCreateLabel("xxxxx", 560, 444, 29, 17)
$Label21 = GUICtrlCreateLabel("xxxxx", 560, 464, 29, 17)
$Label22 = GUICtrlCreateLabel("xxxxx", 560, 484, 29, 17)
$Label23 = GUICtrlCreateLabel("xxxxx", 560, 504, 29, 17)
$Label24 = GUICtrlCreateLabel("xxxxx", 560, 524, 29, 17)
$Label25 = GUICtrlCreateLabel("xxxxx", 560, 544, 29, 17)
$Label26 = GUICtrlCreateLabel("xxxxx", 560, 564, 29, 17)
$Label27 = GUICtrlCreateLabel("xxxxx", 560, 584, 29, 17)
$Label28 = GUICtrlCreateLabel("xxxxx", 560, 604, 29, 17)
$Button3 = GUICtrlCreateButton("Neue Zuweisung generieren", 512, 640, 153, 33)
$Button4 = GUICtrlCreateButton("Manuelle Zuweisung", 512, 688, 153, 33)
$Button5 = GUICtrlCreateButton("Standard", 672, 640, 57, 81)
$Button6 = GUICtrlCreateButton("Funktionstest", 680, 104, 89, 25)
$Zuweisung_a = GUICtrlCreateInput("Zuweisung", 608, 104, 65, 20)
$Zuweisung_b = GUICtrlCreateInput("Zuweisung", 608, 124, 65, 20)
$Zuweisung_c = GUICtrlCreateInput("Zuweisung", 608, 144, 65, 20)
$Zuweisung_d = GUICtrlCreateInput("Zuweisung", 608, 164, 65, 20)
$Zuweisung_e = GUICtrlCreateInput("Zuweisung", 608, 184, 65, 20)
$Zuweisung_f = GUICtrlCreateInput("Zuweisung", 608, 204, 65, 20)
$Zuweisung_g = GUICtrlCreateInput("Zuweisung", 608, 224, 65, 20)
$Zuweisung_h = GUICtrlCreateInput("Zuweisung", 608, 244, 65, 20)
$Zuweisung_i = GUICtrlCreateInput("Zuweisung", 608, 264, 65, 20)
$Zuweisung_j = GUICtrlCreateInput("Zuweisung", 608, 284, 65, 20)
$Zuweisung_k = GUICtrlCreateInput("Zuweisung", 608, 304, 65, 20)
$Zuweisung_l = GUICtrlCreateInput("Zuweisung", 608, 324, 65, 20)
$Zuweisung_m = GUICtrlCreateInput("Zuweisung", 608, 344, 65, 20)
$Zuweisung_n = GUICtrlCreateInput("Zuweisung", 608, 364, 65, 20)
$Zuweisung_o = GUICtrlCreateInput("Zuweisung", 608, 384, 65, 20)
$Zuweisung_p = GUICtrlCreateInput("Zuweisung", 608, 404, 65, 20)
$Zuweisung_q = GUICtrlCreateInput("Zuweisung", 608, 424, 65, 20)
$Zuweisung_r = GUICtrlCreateInput("Zuweisung", 608, 444, 65, 20)
$Zuweisung_s = GUICtrlCreateInput("Zuweisung", 608, 464, 65, 20)
$Zuweisung_t = GUICtrlCreateInput("Zuweisung", 608, 484, 65, 20)
$Zuweisung_u = GUICtrlCreateInput("Zuweisung", 608, 504, 65, 20)
$Zuweisung_v = GUICtrlCreateInput("Zuweisung", 608, 524, 65, 20)
$Zuweisung_w = GUICtrlCreateInput("Zuweisung", 608, 544, 65, 20)
$Zuweisung_x = GUICtrlCreateInput("Zuweisung", 608, 564, 65, 20)
$Zuweisung_y = GUICtrlCreateInput("Zuweisung", 608, 584, 65, 20)
$Zuweisung_z = GUICtrlCreateInput("Zuweisung", 608, 604, 65, 20)

GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###







While 1
	$nMsg = GUIGetMsg()
	Switch $nMsg
		Case $GUI_EVENT_CLOSE
			Exit
		Case $Button3
			_Zuweisung_Zufall()
		Case $Button4
			_Zuweisung_Manuell()
		Case $Button5 
			_Zuweisung_Standard()
		Case $Button6
			_FunktionsTest()
		Case $Button1
			_Verschluesselung_2()
		Case $Button2
			_Entschluesseln()
			
			
			

	EndSwitch
	
	


;Zuweisung der Funktionen und der Zahl_z zur späteren "Divide by Zero" Ausmerzung
Global $sF1 = GUICtrlRead($Input1)
Global $sF2 = 0
Global $Zahl_z = $sF2

; Definition des Suchbereiches
Global $iStart = 0
Global $iEnd = 100
Global $iStep = 0.1




	
WEnd




;Zufällige Wertzuweisung zur Verschlüsslung | Wert zwischen 0.1 und 5.0
Func _Zuweisung_Zufall()
	
	$Max_Bereich = 100
	
	$Zufall_a = Round( Random(0.1, $Max_Bereich), 2)
	$Zufall_b = Round( Random(0.1, $Max_Bereich), 2)
	$Zufall_c = Round( Random(0.1, $Max_Bereich), 2)
	$Zufall_d = Round( Random(0.1, $Max_Bereich), 2)
	$Zufall_e = Round( Random(0.1, $Max_Bereich), 2)
	$Zufall_f = Round( Random(0.1, $Max_Bereich), 2)
	$Zufall_g = Round( Random(0.1, $Max_Bereich), 2)
	$Zufall_h = Round( Random(0.1, $Max_Bereich), 2)
	$Zufall_i = Round( Random(0.1, $Max_Bereich), 2)
	$Zufall_j = Round( Random(0.1, $Max_Bereich), 2)
	$Zufall_k = Round( Random(0.1, $Max_Bereich), 2)
	$Zufall_l = Round( Random(0.1, $Max_Bereich), 2)
	$Zufall_m = Round( Random(0.1, $Max_Bereich), 2)
	$Zufall_n = Round( Random(0.1, $Max_Bereich), 2)
	$Zufall_o = Round( Random(0.1, $Max_Bereich), 2)
	$Zufall_p = Round( Random(0.1, $Max_Bereich), 2)
	$Zufall_q = Round( Random(0.1, $Max_Bereich), 2)
	$Zufall_r = Round( Random(0.1, $Max_Bereich), 2)
	$Zufall_s = Round( Random(0.1, $Max_Bereich), 2)
	$Zufall_t = Round( Random(0.1, $Max_Bereich), 2)
	$Zufall_u = Round( Random(0.1, $Max_Bereich), 2)
	$Zufall_v = Round( Random(0.1, $Max_Bereich), 2)
	$Zufall_w = Round( Random(0.1, $Max_Bereich), 2)
	$Zufall_x = Round( Random(0.1, $Max_Bereich), 2)
	$Zufall_y = Round( Random(0.1, $Max_Bereich), 2)
	$Zufall_z = Round( Random(0.1, $Max_Bereich), 2)
	
	GUICtrlSetData($Label3, $Zufall_a)
	GUICtrlSetData($Label4, $Zufall_b)
	GUICtrlSetData($Label5, $Zufall_c)
	GUICtrlSetData($Label6, $Zufall_d)
	GUICtrlSetData($Label7, $Zufall_e)
	GUICtrlSetData($Label8, $Zufall_f)
	GUICtrlSetData($Label9, $Zufall_g)
	GUICtrlSetData($Label10, $Zufall_h)
	GUICtrlSetData($Label11, $Zufall_i)
	GUICtrlSetData($Label12, $Zufall_j)
	GUICtrlSetData($Label13, $Zufall_k)
	GUICtrlSetData($Label14, $Zufall_l)
	GUICtrlSetData($Label15, $Zufall_m)
	GUICtrlSetData($Label16, $Zufall_n)
	GUICtrlSetData($Label17, $Zufall_o)
	GUICtrlSetData($Label18, $Zufall_p)
	GUICtrlSetData($Label19, $Zufall_q)
	GUICtrlSetData($Label20, $Zufall_r)
	GUICtrlSetData($Label21, $Zufall_s)
	GUICtrlSetData($Label22, $Zufall_t)
	GUICtrlSetData($Label23, $Zufall_u)
	GUICtrlSetData($Label24, $Zufall_v)
	GUICtrlSetData($Label25, $Zufall_w)
	GUICtrlSetData($Label26, $Zufall_x)
	GUICtrlSetData($Label27, $Zufall_y)
	GUICtrlSetData($Label28, $Zufall_z)
	
EndFunc
;Manuelle Wertzuweisung zur Ent- /Verschlüsslung
 Func _Zuweisung_Manuell()
	 
	     If GUICtrlRead($Zuweisung_a) <> "Zuweisung" Then
		 GUICtrlSetData($Label3,GUICtrlRead($Zuweisung_a))
		 EndIf
		 
	     If	GUICtrlRead($Zuweisung_b) <> "Zuweisung" Then
		 GUICtrlSetData($Label4,GUICtrlRead($Zuweisung_b))
		 EndIf
		 
	     If	GUICtrlRead($Zuweisung_c) <> "Zuweisung" Then
		 GUICtrlSetData($Label5,GUICtrlRead($Zuweisung_c))
		 EndIf
		 
	     If	GUICtrlRead($Zuweisung_d) <> "Zuweisung" Then
		 GUICtrlSetData($Label6,GUICtrlRead($Zuweisung_d))
		 EndIf
		 
		 If	GUICtrlRead($Zuweisung_e) <> "Zuweisung" Then
		 GUICtrlSetData($Label7,GUICtrlRead($Zuweisung_e))
		 EndIf
		 
		 If	GUICtrlRead($Zuweisung_f) <> "Zuweisung" Then
		 GUICtrlSetData($Label8,GUICtrlRead($Zuweisung_f))
		 EndIf
		 
		 If	GUICtrlRead($Zuweisung_g) <> "Zuweisung" Then
		 GUICtrlSetData($Label9,GUICtrlRead($Zuweisung_g))
		 EndIf
		 
		 If	GUICtrlRead($Zuweisung_h) <> "Zuweisung" Then
		 GUICtrlSetData($Label10,GUICtrlRead($Zuweisung_h))
		EndIf
	 
	     If	GUICtrlRead($Zuweisung_i) <> "Zuweisung" Then
		 GUICtrlSetData($Label11,GUICtrlRead($Zuweisung_i))
	     EndIf
		 
		 If	GUICtrlRead($Zuweisung_j) <> "Zuweisung" Then
		 GUICtrlSetData($Label12,GUICtrlRead($Zuweisung_j))
		 EndIf
		 
		 If	GUICtrlRead($Zuweisung_k) <> "Zuweisung" Then
		 GUICtrlSetData($Label13,GUICtrlRead($Zuweisung_k))
		 EndIf
		 
		 If	GUICtrlRead($Zuweisung_l) <> "Zuweisung" Then
		 GUICtrlSetData($Label14,GUICtrlRead($Zuweisung_l))
		 EndIf
		 
		 If	GUICtrlRead($Zuweisung_m) <> "Zuweisung" Then
		 GUICtrlSetData($Label15,GUICtrlRead($Zuweisung_m))
		 EndIf
		 
		 If	GUICtrlRead($Zuweisung_n) <> "Zuweisung" Then
		 GUICtrlSetData($Label16,GUICtrlRead($Zuweisung_n))
		 EndIf
		 
		 If	GUICtrlRead($Zuweisung_o) <> "Zuweisung" Then
		 GUICtrlSetData($Label17,GUICtrlRead($Zuweisung_o))
		 EndIf
		 
		 If	GUICtrlRead($Zuweisung_p) <> "Zuweisung" Then
		 GUICtrlSetData($Label18,GUICtrlRead($Zuweisung_p))
		 EndIf
		 
		 If	GUICtrlRead($Zuweisung_q) <> "Zuweisung" Then
		 GUICtrlSetData($Label19,GUICtrlRead($Zuweisung_q))
		 EndIf
		 
		 If	GUICtrlRead($Zuweisung_r) <> "Zuweisung" Then
		 GUICtrlSetData($Label20,GUICtrlRead($Zuweisung_r))
		 EndIf
		 
		 If	GUICtrlRead($Zuweisung_s) <> "Zuweisung" Then
		 GUICtrlSetData($Label21,GUICtrlRead($Zuweisung_s))
		 EndIf
		 
		 If	GUICtrlRead($Zuweisung_t) <> "Zuweisung" Then
		 GUICtrlSetData($Label22,GUICtrlRead($Zuweisung_t))
		 EndIf
		 
		 If	GUICtrlRead($Zuweisung_u) <> "Zuweisung" Then
		 GUICtrlSetData($Label23,GUICtrlRead($Zuweisung_u))
		 EndIf
		 
		 If	GUICtrlRead($Zuweisung_v) <> "Zuweisung" Then
		 GUICtrlSetData($Label24,GUICtrlRead($Zuweisung_v))
		 EndIf
		 
		 If	GUICtrlRead($Zuweisung_w) <> "Zuweisung" Then
		 GUICtrlSetData($Label25,GUICtrlRead($Zuweisung_w))
		 EndIf
		 
		 If	GUICtrlRead($Zuweisung_x) <> "Zuweisung" Then
		 GUICtrlSetData($Label26,GUICtrlRead($Zuweisung_x))
		 EndIf
		 
		 If	GUICtrlRead($Zuweisung_y) <> "Zuweisung" Then
		 GUICtrlSetData($Label27,GUICtrlRead($Zuweisung_y))
		 EndIf
		 
		 If	GUICtrlRead($Zuweisung_z) <> "Zuweisung" Then
		 GUICtrlSetData($Label28,GUICtrlRead($Zuweisung_z))
		 EndIf
		 
	 
 EndFunc
 
 ;Standardzuweisung der Werte
 Func _Zuweisung_Standard()
	 
	 GUICtrlSetData($Label3, 0.3)
	 GUICtrlSetData($Label4, 0.5)
	 GUICtrlSetData($Label5, 0.7)
	 GUICtrlSetData($Label6, 2.1)
	 GUICtrlSetData($Label7, 1.3)
	 GUICtrlSetData($Label8, 1.8)
	 GUICtrlSetData($Label9, 2.3)
	 GUICtrlSetData($Label10, 3.5)
	 GUICtrlSetData($Label11, 2.0)
	 GUICtrlSetData($Label12, 1.9)
	 GUICtrlSetData($Label13, 0.9)
	 GUICtrlSetData($Label14, 3.6)
	 GUICtrlSetData($Label15, 4.1)
	 GUICtrlSetData($Label16, 1.2)
	 GUICtrlSetData($Label17, 4.4)
	 GUICtrlSetData($Label18, 2.9)
	 GUICtrlSetData($Label19, 0.4)
	 GUICtrlSetData($Label20, 3.7)
	 GUICtrlSetData($Label21, 4.6)
	 GUICtrlSetData($Label22, 4.5)
	 GUICtrlSetData($Label23, 2.5)
	 GUICtrlSetData($Label24, 4.7)
	 GUICtrlSetData($Label25, 3.3)
	 GUICtrlSetData($Label26, 4.3)
	 GUICtrlSetData($Label27, 2.6)
	 GUICtrlSetData($Label28, 5.2)
 EndFunc
 
	 
 
		 
		 
		 
 
;Testet die gebebene Funtion mit dem Wert 0.1		 
Func _FunktionsTest()

Global $sF2 = 0.1

; Größer/Kleiner Vergleichskriterium
Global $bSw = _Fx($sF1, $iStart) > _Fx($sF2, $iStart)






For $x = $iStart To $iEnd Step $iStep ; Gehe den Bereich grob ab
    If $bSw <> (_Fx($sF1, $x) > _Fx($sF2, $x)) Then ; Wenn Wechsel der Größer/Kleiner Beziehung dann muss Schnittpunkt dazwischen liegen
        $bSw = Not $bSw
        $dX_Schnitt = Schnittsuche($sF1, $sF2, $x - $iStep, $x) ; Starte die feine Schnittpunktsuche im Intervall
        $dY_Schnitt = (_Fx($sF1, $dX_Schnitt) + _Fx($sF2, $dX_Schnitt)) / 2 ;Y-Wert als Mittelwert beider Funktionswerte bestimmen
		
	;MsgBox(0, "Schnittpunkt gefunden", "x = " & $dX_Schnitt & @CRLF & "y = " & $dY_Schnitt)
	MsgBox(0, "Alles in Ordnung", "Die Funktion scheint in Ordnung zu sein. Diese Meldung muss noch einmal erscheinen, dann ist alles in Ordnung")
	
	_FunktionsTest_2()
	
	ExitLoop
	
    EndIf
Next
EndFunc


Func _Fx(Const $sF, Const $dW)
    Return Number(Execute(StringReplace($sF, "x", "(" & $dW & ")")))
EndFunc   ;==>_Fx


; Schnittfunktion
; Hinweis: Sollte noch ungültige Ergebnisse liefern wenn einer der Grenzen = dem Schnittpunkt
Func Schnittsuche(Const $sF1, Const $sF2, $dA, $dB, $iMaxIt = 100)
    
    Local $xA = $dA, $xB = $dB
    Local $Ya, $Yb, $x, $Yx
    Local $xOld = $dB

    For $n = 1 To $iMaxIt
        $Ya = _Fx($sF1, $xA) - _Fx($sF2, $xA) 
        $Yb = _Fx($sF1, $xB) - _Fx($sF2, $xB)
        $x = $xA - ($Ya * ($xB - $xA)) / ($Yb - $Ya)
        $Yx = _Fx($sF1, $x) - _Fx($sF2, $x)

        If Abs($x - $xOld) < (4 * $FLT_EPSILON) Or Abs($Yx) < (5 * $FLT_EPSILON) Then 
            Return $x
        Else 
            $xOld = $x
            If $Ya > $Yx Then
                $xA = $x
            Else
                $xB = $x
            EndIf
        EndIf

    Next
    Return SetError(1, $iMaxIt, $x)
EndFunc  




Func _GET_FLT_EPSILON()
    Local $x = 1
    Do
        $x /= 2
    Until 1 + $x <= 1
    Return $x
EndFunc   

;Testet die gebebene Funtion mit dem Wert 9
Func _FunktionsTest_2()

Global $sF2 = 100

; Größer/Kleiner Vergleichskriterium
Global $bSw = _Fx($sF1, $iStart) > _Fx($sF2, $iStart)






For $x = $iStart To $iEnd Step $iStep 
    If $bSw <> (_Fx($sF1, $x) > _Fx($sF2, $x)) Then 
        $bSw = Not $bSw
        $dX_Schnitt = Schnittsuche($sF1, $sF2, $x - $iStep, $x) 
        $dY_Schnitt = (_Fx($sF1, $dX_Schnitt) + _Fx($sF2, $dX_Schnitt)) / 2 
		
	
	MsgBox(0, "Alles in Ordnung", "Die Funktion ist in Ordnung. Sie können jetzt beginnen")
	
	
	ExitLoop
	
    EndIf
Next
EndFunc

	 


	
	
Func _Wertberechnung_1()
	

; Größer/Kleiner Vergleichskriterium
Global $bSw = _Fx($sF1, $iStart) > _Fx($sF2, $iStart)






For $x = $iStart To $iEnd Step $iStep
    If $bSw <> (_Fx($sF1, $x) > _Fx($sF2, $x)) Then 
        $bSw = Not $bSw
        $dX_Schnitt = Schnittsuche($sF1, $sF2, $x - $iStep, $x) 
        $dY_Schnitt = (_Fx($sF1, $dX_Schnitt) + _Fx($sF2, $dX_Schnitt)) / 2 
		
		
		GUICtrlSetData($Ausgabe  , Round($dX_Schnitt,5) & ";",";")
		
	
	
	
	ExitLoop
	
    EndIf
Next
EndFunc




Func _Verschluesselung_2()
	$EingabeText = GUICtrlRead($Eingabe)
	$EingabeText_2 = StringLower($EingabeText)
	$EingabeText_3 = StringReplace($EingabeText_2, " ", "")
	$EingabeText_4 = StringReplace($EingabeText_3, ".", "")
	$EingabeText_5 = StringReplace($EingabeText_4, ",", "")
	$EingabeText_6 = StringReplace($EingabeText_5, ";", "")
	$EingabeText_7 = StringReplace($EingabeText_6, "!", "")
	$EingabeText_8 = StringReplace($EingabeText_7, "?", "")
	$EingabeText_9 = StringReplace($EingabeText_8, "-", "bindestrich")
	$EingabeText_10 = StringReplace($EingabeText_9, "&", "und")
	$EingabeText_11 = StringReplace($EingabeText_10, "%", "prozent")
	$EingabeText_12 = StringReplace($EingabeText_11, "+", "plus")
	$EingabeText_13 = StringReplace($EingabeText_12, "/", "geteilt")
	$EingabeText_14 = StringReplace($EingabeText_13, "<", "kleiner")
	$EingabeText_15 = StringReplace($EingabeText_14, "0", "null")
	$EingabeText_16 = StringReplace($EingabeText_15, "1", "eins")
	$EingabeText_17 = StringReplace($EingabeText_16, "2", "zwei")
	$EingabeText_18 = StringReplace($EingabeText_17, "3", "drei")
	$EingabeText_19 = StringReplace($EingabeText_18, "4", "vier")
	$EingabeText_20 = StringReplace($EingabeText_19, "5", "fünf")
	$EingabeText_21 = StringReplace($EingabeText_20, "6", "sechs")
	$EingabeText_22 = StringReplace($EingabeText_21, "7", "sieben")
	$EingabeText_23 = StringReplace($EingabeText_22, "8", "acht")
	$EingabeText_24 = StringReplace($EingabeText_23, "9", "neun")
	$EingabeText_25 = StringReplace($EingabeText_24, ">", "größer")
	Global $EingabeText_26 = StringSplit($EingabeText_25, "")
	Global $ArrayLaenge = $EingabeText_26[0]
	
	
	
	_Verschluesselung_3()
	
	
EndFunc


Func _Verschluesselung_3()
	 
	GUICtrlSetData( $Ausgabe, "") 
	
	For $i = 0  to $ArrayLaenge  Step 1
		
	Local $AktuellerBuchstabe =	$EingabeText_26[$i]
	$Buchstabe = $AktuellerBuchstabe
	If $Buchstabe = "a" Then 
		Global $sF2 = GUICtrlRead($Label3)
		_Wertberechnung_1()
	ElseIf $Buchstabe = "b" Then 
		Global $sF2 = GUICtrlRead($Label4)
		_Wertberechnung_1()
	ElseIf $Buchstabe = "c" Then 
		Global $sF2 = GUICtrlRead($Label5)
		_Wertberechnung_1()
	ElseIf $Buchstabe = "d" Then 
		Global $sF2 = GUICtrlRead($Label6)
		_Wertberechnung_1()
	ElseIf $Buchstabe = "e" Then 
		Global $sF2 = GUICtrlRead($Label7)
		_Wertberechnung_1()
	ElseIf $Buchstabe = "f" Then 
		Global $sF2 = GUICtrlRead($Label8)
		_Wertberechnung_1()
	ElseIf $Buchstabe = "g" Then 
		Global $sF2 = GUICtrlRead($Label9)
		_Wertberechnung_1()
	ElseIf $Buchstabe = "h" Then 
		Global $sF2 = GUICtrlRead($Label10)
		_Wertberechnung_1()
	ElseIf $Buchstabe = "i" Then 
		Global $sF2 = GUICtrlRead($Label11)
		_Wertberechnung_1()
	ElseIf $Buchstabe = "j" Then 
		Global $sF2 = GUICtrlRead($Label12)
		_Wertberechnung_1()
	ElseIf $Buchstabe = "k" Then 
		Global $sF2 = GUICtrlRead($Label13)
		_Wertberechnung_1()
	ElseIf $Buchstabe = "l" Then 
		Global $sF2 = GUICtrlRead($Label14)
		_Wertberechnung_1()
	ElseIf $Buchstabe = "m" Then 
		Global $sF2 = GUICtrlRead($Label15)
		_Wertberechnung_1()
	ElseIf $Buchstabe = "n" Then 
		Global $sF2 = GUICtrlRead($Label16)
		_Wertberechnung_1()
	ElseIf $Buchstabe = "o" Then 
		Global $sF2 = GUICtrlRead($Label17)
		_Wertberechnung_1()
	ElseIf $Buchstabe = "p" Then 
		Global $sF2 = GUICtrlRead($Label18)
		_Wertberechnung_1()
	ElseIf $Buchstabe = "q" Then 
		Global $sF2 = GUICtrlRead($Label19)
		_Wertberechnung_1()
	ElseIf $Buchstabe = "r" Then 
		Global $sF2 = GUICtrlRead($Label20)
		_Wertberechnung_1()
	ElseIf $Buchstabe = "s" Then 
		Global $sF2 = GUICtrlRead($Label21)
		_Wertberechnung_1()
	ElseIf $Buchstabe = "t" Then 
		Global $sF2 = GUICtrlRead($Label22)
		_Wertberechnung_1()
	ElseIf $Buchstabe = "u" Then 
		Global $sF2 = GUICtrlRead($Label23)
		_Wertberechnung_1()
	ElseIf $Buchstabe = "v" Then 
		Global $sF2 = GUICtrlRead($Label24)
		_Wertberechnung_1()
	ElseIf $Buchstabe = "w" Then 
		Global $sF2 = GUICtrlRead($Label25)
		_Wertberechnung_1()
	ElseIf $Buchstabe = "x" Then 
		Global $sF2 = GUICtrlRead($Label26)
		_Wertberechnung_1()
	ElseIf $Buchstabe = "y" Then 
		Global $sF2 = GUICtrlRead($Label27)
		_Wertberechnung_1()
	ElseIf $Buchstabe = "z" Then 
		Global $sF2 = GUICtrlRead($Label28)
	    _Wertberechnung_1()	
		
	
		
	EndIf
	
	
    Next
EndFunc


Func _Entschluesseln()
	GUICtrlSetData($Ausgabe, "")
	$XWerte = StringSplit(GuiCtrlRead($Eingabe), ";")
	$ArrayLaenge_2 = $XWerte[0]
	
	For $i2 = 0  to $ArrayLaenge_2  Step 1
		$XWertAktuell = $XWerte[$i2]
		
		$YWert = 0
		Global $Differenz = 0.005
		
	     $YWert = Round(_Fx($sF1, $XWertAktuell),5)
		 

		 If $YWert < GUICtrlRead($Label3) + 0.005 Then
			 If $YWert > GUICtrlRead($Label3) - 0.005 Then 
				 
				 GUICtrlSetData($Ausgabe,"A " ,";")
			 Else
				 
				 
			 EndIf
		 EndIf
		 
		 
		 If $YWert < GUICtrlRead($Label4) + $Differenz Then
			 If $YWert > GUICtrlRead($Label4) - $Differenz Then 
				 
				 GUICtrlSetData($Ausgabe,"B " ,";")
				 
			 EndIf
		 EndIf
		 
		 If $YWert < GUICtrlRead($Label5) + $Differenz Then
			 If $YWert > GUICtrlRead($Label5) - $Differenz Then 
				 
				 GUICtrlSetData($Ausgabe,"C " ,";")
				 
			 EndIf
		 EndIf
		 
		 If $YWert < GUICtrlRead($Label6) + $Differenz Then
			 If $YWert > GUICtrlRead($Label6) - $Differenz Then 
				 
				 GUICtrlSetData($Ausgabe,"D " ,";")
				 
			 EndIf
		 EndIf
		 
		 If $YWert < GUICtrlRead($Label7) + $Differenz Then
			 If $YWert > GUICtrlRead($Label7) - $Differenz Then 
				 
				 GUICtrlSetData($Ausgabe,"E " ,";")
				 
			 EndIf
		 EndIf
		 
		 If $YWert < GUICtrlRead($Label8) + $Differenz Then
			 If $YWert > GUICtrlRead($Label8) - $Differenz Then 
				 
				 GUICtrlSetData($Ausgabe,"F " ,";")
				 
			 EndIf
		 EndIf
		 
		 If $YWert < GUICtrlRead($Label9) + $Differenz Then
			 If $YWert > GUICtrlRead($Label9) - $Differenz Then 
				 
				 GUICtrlSetData($Ausgabe,"G " ,";")
				 
			 EndIf
		 EndIf
		 
		 If $YWert < GUICtrlRead($Label10) + $Differenz Then
			 If $YWert > GUICtrlRead($Label10) - $Differenz Then 
				 
				 GUICtrlSetData($Ausgabe,"H " ,";")
				 
			 EndIf
		 EndIf
		 
		 If $YWert < GUICtrlRead($Label11) + $Differenz Then
			 If $YWert > GUICtrlRead($Label11) - $Differenz Then 
				 
				 GUICtrlSetData($Ausgabe,"I " ,";")
				 
			 EndIf
		 EndIf
		 
		 If $YWert < GUICtrlRead($Label12) + $Differenz Then
			 If $YWert > GUICtrlRead($Label12) - $Differenz Then 
				 
				 GUICtrlSetData($Ausgabe,"J " ,";")
				 
			 EndIf
		 EndIf
		 
		 If $YWert < GUICtrlRead($Label13) + $Differenz Then
			 If $YWert > GUICtrlRead($Label13) - $Differenz Then 
				 
				 GUICtrlSetData($Ausgabe,"K " ,";")
				 
			 EndIf
		 EndIf
		 
		 If $YWert < GUICtrlRead($Label14) + $Differenz Then
			 If $YWert > GUICtrlRead($Label14) - $Differenz Then 
				 
				 GUICtrlSetData($Ausgabe,"L " ,";")
				 
			 EndIf
		 EndIf
		 
		 If $YWert < GUICtrlRead($Label15) + $Differenz Then
			 If $YWert > GUICtrlRead($Label15) - $Differenz Then 
				 
				 GUICtrlSetData($Ausgabe,"M " ,";")
				 
			 EndIf
		 EndIf
		 
		 If $YWert < GUICtrlRead($Label16) + $Differenz Then
			 If $YWert > GUICtrlRead($Label16) - $Differenz Then 
				 
				 GUICtrlSetData($Ausgabe,"N " ,";")
				 
			 EndIf
		 EndIf
		 
		 If $YWert < GUICtrlRead($Label17) + $Differenz Then
			 If $YWert > GUICtrlRead($Label17) - $Differenz Then 
				 
				 GUICtrlSetData($Ausgabe,"O " ,";")
				 
			 EndIf
		 EndIf
		 
		 If $YWert < GUICtrlRead($Label18) + $Differenz Then
			 If $YWert > GUICtrlRead($Label18) - $Differenz Then 
				 
				 GUICtrlSetData($Ausgabe,"P " ,";")
				 
			 EndIf
		 EndIf
		 
		 If $YWert < GUICtrlRead($Label19) + $Differenz Then
			 If $YWert > GUICtrlRead($Label19) - $Differenz Then 
				 
				 GUICtrlSetData($Ausgabe,"Q " ,";")
				 
			 EndIf
		 EndIf
		 
		 If $YWert < GUICtrlRead($Label20) + $Differenz Then
			 If $YWert > GUICtrlRead($Label20) - $Differenz Then 
				 
				 GUICtrlSetData($Ausgabe,"R " ,";")
				 
			 EndIf
		 EndIf
		 
		 If $YWert < GUICtrlRead($Label21) + $Differenz Then
			 If $YWert > GUICtrlRead($Label21) - $Differenz Then 
				 
				 GUICtrlSetData($Ausgabe,"S " ,";")
				 
			 EndIf
		 EndIf
		 
		 If $YWert < GUICtrlRead($Label22) + $Differenz Then
			 If $YWert > GUICtrlRead($Label22) - $Differenz Then 
				 
				 GUICtrlSetData($Ausgabe,"T " ,";")
				 
			 EndIf
		 EndIf
		 
		 If $YWert < GUICtrlRead($Label23) + $Differenz Then
			 If $YWert > GUICtrlRead($Label23) - $Differenz Then 
				 
				 GUICtrlSetData($Ausgabe,"U " ,";")
				 
			 EndIf
		 EndIf
		 
		 If $YWert < GUICtrlRead($Label24) + $Differenz Then
			 If $YWert > GUICtrlRead($Label24) - $Differenz Then 
				 
				 GUICtrlSetData($Ausgabe,"V " ,";")
				 
			 EndIf
		 EndIf
		 
		 If $YWert < GUICtrlRead($Label25) + $Differenz Then
			 If $YWert > GUICtrlRead($Label25) - $Differenz Then 
				 
				 GUICtrlSetData($Ausgabe,"W " ,";")
				 
			 EndIf
		 EndIf
		 
		 If $YWert < GUICtrlRead($Label26) + $Differenz Then
			 If $YWert > GUICtrlRead($Label26) - $Differenz Then 
				 
				 GUICtrlSetData($Ausgabe,"X " ,";")
				 
			 EndIf
		 EndIf
		 
		 If $YWert < GUICtrlRead($Label27) + $Differenz Then
			 If $YWert > GUICtrlRead($Label27) - $Differenz Then 
				 
				 GUICtrlSetData($Ausgabe,"Y " ,";")
				 
			 EndIf
		 EndIf
		 
		 If $YWert < GUICtrlRead($Label28) + $Differenz Then
			 If $YWert > GUICtrlRead($Label28) - $Differenz Then 
				 
				 GUICtrlSetData($Ausgabe,"Z " ,";")
				 
			 EndIf
		 EndIf
		 
	 Next
	 
	 
 EndFunc
 
		 
		 
		 
		 
		 
		 
		 
		 
		 
		 
	
	 
				 
			 
		 
	
	 



	