C'est un programme d'encodage de texte plutôt vicieux car s'il vous manque la lettre le résultat changera complètement
► Afficher le textecode
Code : Tout sélectionner
#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <String.au3>
#include <Array.au3>
Opt("GUIOnEventMode", 1)
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Super-codeur", 425, 442, 249, 337)
GUISetOnEvent($GUI_EVENT_CLOSE, "close")
GUICtrlCreateLabel("texte",8,24,30,21)
Global $input=GUICtrlCreateInput("", 50, 24, 305, 21)
GUICtrlCreateLabel("clef",8,2,30,21)
Global $clef=GUICtrlCreateInput("",50,1,100,21)
$Button1 = GUICtrlCreateButton("Coder", 8, 56, 75, 25)
GUICtrlSetOnEvent(-1,"coder")
$Button2 = GUICtrlCreateButton("Decoder", 96, 56, 75, 25)
GUICtrlSetOnEvent(-1,"decoder")
$edit = GUICtrlCreateEdit("", 0, 96, 425, 337,$ES_MULTILINE+$ES_READONLY+$WS_VSCROLL)
$Button3 = GUICtrlCreateButton("copier", 184, 56, 163, 25)
GUICtrlSetOnEvent(-1,"copier")
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
Global $liste[39]=["a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","0","1","2","3","4","5","6","7","8","9","'","?",","]
Global $liste_de[42]=["&",".","(",")","[","]","{","}","-","_","+","é","è","/","\","=","ê","ô","û","î","ï","ö","ü",'"',"à","ç","@","^","¨","~",":",";","$","¤","£","!","|","`","ò","ì","ù","à"]
For $nb=0 To UBound($liste)-1
Assign($liste[$nb],$nb)
Next
Global $secure=0
Global $ubound=UBound($liste)-1
Global $ubound_de=UBound($liste_de)-1
While 1
Sleep(1000)
WEnd
Func close()
Exit
EndFunc
Func copier()
Local $string=GUICtrlRead($edit)
ClipPut($string)
EndFunc
Func decoder()
local $clef=GUICtrlRead($input)
GUICtrlSetData($input,"")
GUICtrlSetData($edit,changer($clef,GUICtrlRead($clef),1))
EndFunc
Func coder()
local $clef=GUICtrlRead($input)
GUICtrlSetData($input,"")
GUICtrlSetData($edit,changer($clef,GUICtrlRead($clef),0))
EndFunc
Func changer($string,$clef_code,$codere)
Local $solution=""
Local $code=0
local $string_avant
Local $string_apres
if stringlen($string)=0 Then return 0
if $codere=1 Then $string=StringReverse($string)
Local $array=StringSplit($string," ",2)
Local $code_depart=0
For $nb_quatre=1 to StringLen($clef_code)
$code_depart+=evall(stringmid($clef_code,$nb_quatre,1))
Next
For $nb=0 To UBound($array)-1
$string_avant=$nb-1
If $string_avant>=0 Then
$string_avant=stringlen($array[$string_avant])-$codere
Else
$string_avant=StringLen($array[UBound($array)-1])-$codere
EndIf
$string_apres=$nb+1
If $string_apres<Ubound($array) Then
$string_apres=StringLen($array[$string_apres])-$codere
Else
$string_apres=StringLen($array[0])-$codere
EndIf
For $nb_deux=1 to StringLen($array[$nb])-$codere
$code=$code_depart
For $nb_trois=($string_avant)*(-1) to $string_apres
$code+=Abs($nb_trois)*20
Next
$code+=StringLen($array[$nb])-$codere
$code+=Abs($nb_deux*$nb_deux-$nb_deux)+2
$code+=UBound($array)*(5+$code_depart)
$code+=(StringLen($string)-Ubound($array)*$codere)*(10+$code_depart)
$solution&=change(StringMid($array[$nb],$nb_deux,1),$code,$codere)
Next
If $codere=0 Then $solution&=$liste[Random(0,Ubound($liste)-1,1)]
$solution&=" "
Next
$solution=StringLeft($solution,Stringlen($solution)-1)
If $codere=0 Then $solution=StringReverse($solution)
return $solution
EndFunc
Func change($string,$code,$source)
local $letre=evall($string)
Local $valeur=$letre+($code*(($source*(-2))+1))
return divise($code,$valeur)
EndFunc
Func evall($texte)
Local $letre=Eval($texte)
if $letre="" Then $letre=caractere($texte)
Return $letre
EndFunc
Func divise($nb,$valeur)
if $secure=0 Then
$nb=trouve($valeur,$ubound)
return $liste[$nb]
Else
$nb=trouve($valeur,$ubound_de)
$secure=0
return $liste_de[$nb]
EndIf
EndFunc
Func trouve($un,$de)
$de+=1
While $un<0
$un+=$de
WEnd
While $un>=$de
$un-=$de
WEnd
return $un
EndFunc
Func caractere($letre)
For $nb=0 to $ubound_de
If $letre==$liste_de[$nb] Then
$secure=1
Return $nb
EndIf
Next
EndFunc
Au fait pas forcement besoin de mettre une clef sa fonctionne quand même