Page 1 of 1

A password window!!

Posted: 24 Aug 2015, 00:52
by Kamal Awasthi

Code: Select all

/*
*************************************************
How to run.

1.reads the the content of password.txt as password and matches it with the entry give by the user.
2. To run the script and test it just make a txt file namely password.txt in the same folder .
3. Launch the password window with the shortcut [winKey]+[p] after compiling the script.

*********************************************************
*/

/*
USES:
You can use this script to mask any personal app of yours wuth a password window.
*/


;password window
#o::

global Array := Object()
Loop, Read,password.txt                                           ;LOOP TO READ THE BUTTON FILE
{
    Array.Insert(A_LoopReadLine) 

}     

InputBox, password, Welcome!Enter Password, Enter the Password , hide
if  password=                           ;IF NONE IS SELECTED , RETURN
return

if (password=Array[1])
 MsgBox Correct password
 else
{  MsgBox Incorrect Password,Try again by Launching the app again.
}

Re: A password window!!

Posted: 26 Aug 2015, 08:19
by Alibaba
This provides no real security at all, since you have to store your password as plain text.
But here is some improvement suggestion:
-don't save the password, instead save its SHA512 hash.
-check the entered password by comparing the hashes.
-encode the script that you want to mask with the password, and only if the hash comparison succeeds, decode it with the entered password. For all of this you could use https://github.com/ahkscript/libcrypt.ahk
Have a nice day! :)

Re: A password window!!

Posted: 27 Aug 2015, 07:47
by ozzii
Alibaba wrote: -encode the script that you want to mask with the password, and only if the hash comparison succeeds, decode it with the entered password.
I have a question: how do you do that ? Can you gave me an quick example please.

Re: A password window!!

Posted: 27 Aug 2015, 10:40
by Alibaba
ozzii wrote:Can you gave me an quick example please.
Sure! I wrote a little example, it's very self explaining, just download the attachment and try it by starting the Encrypt.ahk ;)
encrypt_script.zip
(9.58 KiB) Downloaded 162 times
Btw, it is using the Crypt lib by Deo: http://www.autohotkey.com/board/topic/6 ... n-hashing/

Re: A password window!!

Posted: 28 Aug 2015, 03:48
by ozzii
Thanks I will look into this

Re: A password window!!

Posted: 28 Aug 2015, 04:40
by Kamal Awasthi
I just wrote the script to having toe an idea about posting on forum.But i think, it was a nice thing to do. You gave me knowledge about encrypting and security field. I will surely look for your idea.

Re: A password window!!

Posted: 28 Aug 2015, 04:47
by Kamal Awasthi
And I used this script to have a mask on the script having the list of the hidden files. So every time i want to open any hidden file you will have to enter the password will will eventually run the script for that window. And you can also hide the files of this script, so that no one comes tyo know about your password. But anyways, thanks for your valuable idea. I will look forward to it. Thank You very much.

Re: A password window!!

Posted: 28 Aug 2015, 05:07
by Alibaba
Of course it's perfectly fine to use this script on your own machine. I just wanted to warn you that this method isn't safe, regardless of hiding files, compiling scripts, etc...
It's only important that you don't give this script to anyone else to use, calling it protected.

Re: A password window!!

Posted: 31 Aug 2015, 00:31
by Kamal Awasthi
Ok!! I will mark your words.And thanks for the ecryption script you provided.