#include #include #include #include Func Login() Local $gui = GUICreate("Crypt", 220, 110) Local $ctrl0 = GUICtrlCreateInput("Username:", 10, 10, 200, 20) Local $ctrl1 = GUICtrlCreateInput("Password:", 10, 40, 200, 20) Local $button0 = GUICtrlCreateButton("Log in", 10, 70, 95, 30) Local $button1 = GUICtrlCreateButton("Exit", 115, 70, 95, 30) GUISetState(@SW_SHOW, $gui) Local Const $user = "Caty" Local Const $pass = 1234 Local $in00 = "" Local $in01 = "" Local $att = 3 While 1 If GUIGetMsg($gui) = $button0 Then If GUICtrlRead($ctrl0) = $user And GUICtrlRead($ctrl1) = $pass Then GUISetState(@SW_HIDE, $gui) GUIDelete($gui) Return True Else If $att = 3 Then GUISetBkColor(0xFF9911, $gui) ElseIf $att = 2 Then GUISetBkColor(0xFF6611, $gui) ElseIf $att = 1 Then GUISetBkColor(0xFF3311, $gui) Else GUISetState(@SW_HIDE, $gui) GUIDelete($gui) Exit EndIf $att = $att - 1 EndIf ElseIf GUIGetMsg($gui) = $button1 or GUIGetMsg($gui) = $GUI_EVENT_CLOSE Then GUISetState(@SW_HIDE, $gui) GUIDelete($gui) Exit EndIf Sleep(10) WEnd EndFunc Func Mode() Local $gui = GUICreate("Crypt", 120, 130) Local $button0 = GUICtrlCreateButton("Encrypt", 10, 10, 100, 50) Local $button1 = GUICtrlCreateButton("Decrypt", 10, 70, 100, 50) GUISetState(@SW_SHOW, $gui) While 1 If GUIGetMsg() = $button0 Then GUISetState(@SW_HIDE, $gui) GUIDelete($gui) Return 1 ElseIf GUIGetMsg() = $button1 Then GUISetState(@SW_HIDE, $gui) GUIDelete($gui) Return 2 ElseIf GUIGetMsg() = $GUI_EVENT_CLOSE Then GUISetState(@SW_HIDE, $gui) GUIDelete($gui) Return 0 EndIf WEnd EndFunc Func Encryption() Local $gui = GUICreate("Crypt", 200, 140) Local $ctrl0 = GUICtrlCreateInput("Filename", 10, 10, 180, 30) Local $ctrl1 = GUICtrlCreateInput("Text", 10, 50, 180, 30) Local $button = GUICtrlCreateButton("Encrypt", 10, 90, 180, 40) GUISetBkColor(0xFF8811, $gui) GUISetState(@SW_SHOW, $gui) While 1 If GUIGetMsg() = $button Then ExitLoop Else Sleep(25) EndIf WEnd Local $f = FileOpen("D:\documents\coding\Crypt\" & GUICtrlRead($ctrl0), $FO_APPEND) Local $text = StringSplit(GUICtrlRead($ctrl1),'',2) Local $len = UBound($text) Local $tmp = "" FileWrite($f, $len & @CRLF) For $i = 0 To $len-1 $tmp = "" $tmp = AscW($text[$i]) $tmp = $tmp * 29212 $tmp = $tmp / 18108 $tmp = $tmp * 14481 $tmp = $tmp / 10857 $tmp = $tmp * 31627 $tmp = $tmp / 24087 $tmp = $tmp * 15835 $tmp = $tmp / 25878 $tmp = $tmp * 11957 $tmp = $tmp / 27520 $tmp = $tmp * 01324 FileWrite($f, $tmp & @CRLF) Next GUISetBkColor(0x11FF88, $gui) FileClose($f) GUISetState(@SW_HIDE, $gui) GUIDelete($gui) Return True EndFunc Func Decryption() Local $gui = GUICreate("Crypt", 200, 140) Local $ctrl0 = GUICtrlCreateInput("Encrypted", 10, 10, 180, 30) Local $ctrl1 = GUICtrlCreateInput("Decrypted", 10, 50, 180, 30) Local $button = GUICtrlCreateButton("Decrypt", 10, 90, 180, 40) GUISetBkColor(0xFF8811, $gui) GUISetState(@SW_SHOW, $gui) While 1 If GUIGetMsg() = $button Then ExitLoop Else Sleep(25) EndIf WEnd Local $fin = FileOpen("D:\documents\coding\Crypt\" & GUICtrlRead($ctrl0), $FO_APPEND) Local $len = Number(FileReadLine($fin,1)) Local $tmp0, $tmp1, $tmp2 For $i = 0 To $len-1 $tmp0 = "" $tmp1 = "" $tmp0 = Dec(Number(FileReadLine($fin,$i+1))) $tmp0 = $tmp0 / 01324 $tmp0 = $tmp0 * 27520 $tmp0 = $tmp0 / 11957 $tmp0 = $tmp0 * 25878 $tmp0 = $tmp0 / 15835 $tmp0 = $tmp0 * 24087 $tmp0 = $tmp0 / 31627 $tmp0 = $tmp0 * 10857 $tmp0 = $tmp0 / 14481 $tmp0 = $tmp0 * 18108 $tmp0 = $tmp0 / 29212 $tmp0 = ChrW($tmp0) $tmp1 = String($tmp1) + String($tmp0) Next GUISetBkColor(0x11FF88, $gui) FileClose($fin) Local $fou = FileOpen("D:\documents\coding\Crypt\" & GUICtrlRead($ctrl1), $FO_APPEND) FileWrite($fou, $tmp2) FileClose($fou) GUISetState(@SW_HIDE, $gui) GUIDelete($gui) Return True EndFunc Func Main() Login() While 1 Local $mode = Mode() If $mode = 1 Then Encryption() ElseIf $mode = 2 Then Decryption() Else Exit EndIf WEnd EndFunc Main()