Jump to content

Enc/Decrypt apps


Queener
 Share

Go to solution Solved by Queener,

Recommended Posts

I'm just doing this for fun and learning experience. This is a simple tool to encrypt and decrypt a password. If a user press Encrypt, it suppose to write the encrypted password to a txt file called Enc.txt. Same with Decrypted. The problem is

It's adding text to the text file instead of wiping it then rewrite each time you press Encrypt/Decrypt.

example: Instead of

test

when you press 2x, it would display

testtest
Func _Encry()
Global $file1 = Fileopen("Enc.txt", 1)

if $file1 = -1 Then
    msgbox(0, "ERROR", "Unable to open file.")
    Exit
EndIf

    while 1
Global $sPasswordCT = guictrlread($pw)
Global $Jamon = ''
$Jamon = _Encrypt("password", $sPasswordCT)
GUICtrlSetData($hash, $Jamon)
FileWrite($file1, Guictrlread($hash))
sleep(200)
FileClose($file1)
Return
WEnd
EndFunc

Func _Decry()
    Global $file2 = FIleopen("Dec.txt", 1)

    If $file2 = -1 Then
    msgbox(0, "ERROR", "Unable to open file.")
    Exit
EndIf


    while 1
Global $sPasswordCT = guictrlread($hash)
Global $Jamon = ''
$Jamon = _Decrypt("password", $sPasswordCT)
GUICtrlSetData($pw, $Jamon)
Filewrite($file2, $Jamon)
sleep(200)
Fileclose($file2)
WEnd
EndFunc
Edited by asianqueen

Msgbox(0, "Hate", "Just hate it when I post a question and find my own answer after a couple tries. But if I don't post the question, I can't seem to resolve it at all.")
Link to comment
Share on other sites

  • Solution

I set the 1 as fileopen which I should be setting it 2 = Write mode (erase previous contents)

close.

Msgbox(0, "Hate", "Just hate it when I post a question and find my own answer after a couple tries. But if I don't post the question, I can't seem to resolve it at all.")
Link to comment
Share on other sites

use flag 2

Global $file1 = Fileopen("Enc.txt", 2)

 

saludos

Edited:

I was slow :S  lol

Edited by Danyfirex
Link to comment
Share on other sites

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...