Cộng đồng AutoIT Việt - Autoitviet.forumvi.com
Chào mừng bạn đến với cộng đồng AutoIT Việt, hãy đăng ký một nick để cùng tham gia thảo luận nhé ^^!

Join the forum, it's quick and easy

Cộng đồng AutoIT Việt - Autoitviet.forumvi.com
Chào mừng bạn đến với cộng đồng AutoIT Việt, hãy đăng ký một nick để cùng tham gia thảo luận nhé ^^!
Cộng đồng AutoIT Việt - Autoitviet.forumvi.com
Bạn có muốn phản ứng với tin nhắn này? Vui lòng đăng ký diễn đàn trong một vài cú nhấp chuột hoặc đăng nhập để tiếp tục.
Latest topics
» [Code] Kiểm tra kết nối mạng
by jameseshell Fri Jul 31, 2015 3:29 pm

» AutoClick không chiếm chuột
by jameseshell Fri Jul 31, 2015 9:58 am

» [Sorf] Connect/Disconet Button
by thanhhan31 Fri Jun 26, 2015 3:56 am

» Giới thiệu ngôn ngữ lập trình Autoit
by vanhoa1402 Mon Jun 08, 2015 12:40 am

» [Code] Đếm ngược thời gian
by satoh290801 Sat Jun 06, 2015 10:11 am

» Debug game online
by cheater Mon Jun 01, 2015 3:15 pm

» [Thắc Mắc] cách nhập xuất dữ liệu
by cadilacst Mon Apr 27, 2015 7:14 am

» [Code] Auto Win 2c6f td1 - sv HN
by Hades Wed Jan 14, 2015 5:41 am

» [Hỏi] AutoIt với CSDL online?
by todzin Wed Nov 19, 2014 11:14 pm

» [Hỏi] Một số vấn đề về Copy & Paste file bằng ứng dụng thứ 3 (Everything.exe)
by aloatiso Tue Nov 11, 2014 10:31 pm

» Click theo điểm ảnh !
by nhatdaica055 Wed Oct 15, 2014 5:17 pm

» Nội quy diễn đàn
by lethusinh01 Fri Sep 12, 2014 3:59 am

» Hide Windows !!!
by Sweetsica Fri Aug 08, 2014 2:31 am

» Cài đặt , sử dụng và biên dịch Autoit
by mankichi Thu Jul 24, 2014 5:11 am

» Tuyển mod cho diễn đàn
by huynhlamid Fri Jan 17, 2014 3:36 pm

» PixelSearch - Quét (hay kiểm tra) điểm ảnh
by vanthang Fri Jan 17, 2014 5:49 am

» Thiệp Cực Đẹp Tặng Người Yêu !!!
by Nokia3G Mon Dec 23, 2013 12:50 pm

» Lấy đường dẫn của phần mềm chạy ngầm
by cuongkoken Sat Dec 21, 2013 1:25 am

» Xin Admin giup do
by xlove_bmt Wed Dec 18, 2013 6:40 am

» [Hỏi] Cần pro chỉ làm trainer game!
by quytucaca Wed May 29, 2013 7:43 am


[Soft] Mã hóa file text

Go down

[Soft] Mã hóa file text Empty [Soft] Mã hóa file text

Bài gửi by Admin Mon Dec 17, 2012 3:17 am

Code:
#include <WindowsConstants.au3>
#include <GUIConstants.au3>
#include <string.au3>
#include <File.au3>
Global $npass, $percent1 , $percent
Dim $line
Dim $pass
$Form1 = GUICreate("Form1", 384, 320, 151, 169)
GUISetBkColor(0x00000)
$Edit1 = GUICtrlCreateEdit("", 16, 40, 177, 233)
GUICtrlSetBkColor(-1, 0x00000)
GUICtrlSetColor(-1, 0xffffff)
GUICtrlSetFont(-1,12)
$Edit2 = GUICtrlCreateEdit("", 200, 40, 177, 233)
GUICtrlSetBkColor(-1, 0x00000)
GUICtrlSetColor(-1, 0xffffff)
GUICtrlSetFont(-1,12)
$Input1 = GUICtrlCreateInput("", 100, 10, 307, 21)
GUICtrlSetBkColor(-1, 0x00000)
GUICtrlSetColor(-1, 0xffffff)
GUICtrlSetFont(-1,12)
$lable1 = GUICtrlCreateLabel("password", 16, 10, 80)
GUICtrlSetFont(-1,12)
GUICtrlSetColor(-1, 0xffffff)
$Button1 = GUICtrlCreateButton("encrypt", 16, 283, 177, 25, 0)
GUICtrlSetBkColor(-1, 0x00000)
GUICtrlSetColor(-1, 0xffffff)
GUICtrlSetFont(-1,12)
$Button2 = GUICtrlCreateButton("decrypt", 200, 283, 177, 25, 0)
GUICtrlSetBkColor(-1, 0x00000)
GUICtrlSetColor(-1, 0xffffff)
GUICtrlSetFont(-1,12)
GUISetState(@SW_SHOW)
msgbox(0,"How to use","type a password of any size and then click the encryped button select your file" & @crlf & "to decryped click the dycrypt button and select the files")
MAIN()
Func MAIN()
    While 1
        $nMsg = GUIGetMsg()
        Switch $nMsg
            Case $GUI_EVENT_CLOSE
                Exit
            Case $Button1
                encrypt()
            Case $Button2
                decrypt()
        EndSwitch
       
    WEnd
EndFunc  ;==>MAIN

Func encrypt()
    $file = FileOpenDialog("file to encrypt",@scriptdir,"text file (*.txt)")
    $filename = StringSplit($file,"")
    $filename = StringSplit($filename[$filename[0]],".")
    $file = FileRead($file)
    GUICtrlSetData($edit1,$file)

    MsgBox(0, "starting...", "this may take a moment")
    $string1 = StringSplit(GUICtrlRead($Edit1), @CRLF)
   
    ProgressOn("encrypting...","progress on the encryption")
    per($string1[0])
    For $i = 1 To $string1[0] Step 1
   
        $random = Random(1, 5, 1)
        If $string1[$i] > "" Then
            $percent = $percent + $percent1
            $string = _StringEncrypt(1, $string1[$i], GUICtrlRead($Input1), $random)
            FileWriteLine($filename[1] & ".enc", $string)
            FileWriteLine($filename[1] & ".pass", GUICtrlRead($Input1) & "" & $random)
            GUICtrlSetData($Edit2, $string & @CRLF)
            pass()
            ProgressSet($percent, $string1[$i])
        EndIf
    Next
    ProgressOff()
    FileClose($file)
    msgbox(0,"INFO!!!","done")
    main()
    if @error = true Then
        Exit
    EndIf
   
EndFunc  ;==>encrypt
Func pass()
    $npass = ""
    $pass = StringSplit(GUICtrlRead($Input1), "")
    For $i = 1 To $pass[0] Step 1
        $ran = Random(2, 255, 1)
        $passe = Asc($pass[$i]) + $ran
        If $passe > 255 Then
            $passe = $passe - 255
        EndIf
        $passe = Chr($passe)
        $npass = $npass & $passe
        GUICtrlSetData($Input1, $npass)
        Sleep(5)
    Next
    GUICtrlSetData($Input1, $npass)
EndFunc  ;==>pass
Func decrypt()
    GUICtrlSetData($Edit1, "")
    GUICtrlSetData($Edit2, "")
    $file = FileOpenDialog("select file", @ScriptDir, "enc file (*.enc)")

        $filename = StringSplit($file,"/")
    $filename = StringSplit($filename,".")
    $file2 = FileOpenDialog("select file", @ScriptDir, "password file (*.pass)")
    _FileReadToArray($file, $line)
    sleep(5)
    _FileReadToArray($file2, $pass)
    sleep(5)
    If @error = True Then
        MsgBox(0, "ERROR!!!", "YOU DID NOT SELECT A FILE")
    MAIN()
    EndIf
        ProgressOn("decrypting...","progress on the decryption")
            per($line[0])
    For $i = 1 To $line[0] Step 1
       
        If $line[$i] > "" Then
                    $percent = $percent + $percent1
            GUICtrlSetData($Edit1, GUICtrlRead($Edit1) & @CRLF & $line[$i])
            $ran = StringSplit($pass[$i], "")
            $string = _StringEncrypt(0, $line[$i], $ran[1], $ran[2])
            FileWriteLine($filename[1] & ".txt", $string)
            GUICtrlSetData($Edit2, GUICtrlRead($Edit2) & @CRLF & $string)
            ProgressSet($percent, $line[$i])

   
        EndIf
    Next
    ProgressOff()
    msgbox(0,"INFO!!!","done")
        main()
    if @error = true Then
        Exit
    EndIf
EndFunc  ;==>decrypt
func per($stringp)
$percent1 = 100 / $stringp
Return $percent1

EndFunc
Admin
Admin
Admin

Tổng số bài gửi : 63
Join date : 16/08/2011

https://autoitviet.forumvi.com

Về Đầu Trang Go down

Về Đầu Trang

- Similar topics

 
Permissions in this forum:
Bạn không có quyền trả lời bài viết