Jump to content

_StringEncrypt Example.


AlmarM
 Share

Recommended Posts

Hello,

a time ago I made a _StringEncrypt example for someone who had problems with passwords.

I tought i'd just share it with everyone.

#include <String.au3>
#include <EditConstants.au3>
Global $Level = 2 ;1 - 10
Global $Pass = "autoit" ;Can be anything. For more information read '_StringEncrypt()' in the Helpfile.

_Check()
_Password()

Func _Check()
    If FileExists(@ScriptDir & "\Saved Password.ini") And IniRead(@ScriptDir & "\Saved Password.ini", "Password", "Pass", "Not Found") <> "Not Found" Then
        $GetPassword = InputBox("* Password *", "Please enter the password", "", "*", 200, 130)
        $Read_Pass = IniRead(@ScriptDir & "\Saved Password.ini", "Password", "Pass", "Not Found")
        If _StringEncrypt(0, $Read_Pass, $Pass, $Level) == $GetPassword Then
            MsgBox(64, "* Succes *", "Password Correct.")
            _Main()
        Else
            MsgBox(16, "* ERROR *", "Wrong Password!")
            Exit
        EndIf
    EndIf
EndFunc

Func _Password()
    $GUI = GUICreate("* Set Password*", 170, 65, -1, -1)
    $Label = GUICtrlCreateLabel("Password:", 10, 10)
    $Input = GUICtrlCreateInput("", 65, 7, 100, "", $ES_PASSWORD)
    $Button = GUICtrlCreateButton("Set Password!", 10, 35, 150)
    
    GUISetState()
    While 1
        $nMsg = GUIGetMsg()
        Select
        Case $nMsg = -3
            Exit
        Case $nMsg = $Button
            $ReadPassword = GUICtrlRead($Input)
            $Encrypt = _StringEncrypt(1, $ReadPassword, $Pass, $Level)
            IniWrite(@ScriptDir & "\Saved Password.ini", "Password", "Pass", $Encrypt)
            MsgBox(64, "* Succes *", "Password Succesfully Set!")
            Exit
        EndSelect
    WEnd
EndFunc

Func _Main()
    $GUI = GUICreate("* Succes *", 170, 45, -1, -1)
    $Label = GUICtrlCreateLabel("Hi, and Welcome!" & @CRLF & "You entered the right password!", 10, 10)
    
    GUISetState()
    While 1
        $nMsg = GUIGetMsg()
        Select
        Case $nMsg = -3
            Exit
        EndSelect
    WEnd
EndFunc

AlmarM

Edited by AlmarM

Minesweeper

A minesweeper game created in autoit, source available.

_Mouse_UDF

An UDF for registering functions to mouse events, made in pure autoit.

2D Hitbox Editor

A 2D hitbox editor for quick creation of 2D sphere and rectangle hitboxes.

Link to comment
Share on other sites

  • 1 year later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...