Home Upgrade Search Memberlist Extras Hacker Tools Award Goals Help Wiki Contact

Python 

How to make a password/key not readable?

hi,
I want to make a simple gui that does this :

This is where i want the user to enter their key, that they could have gotten from me in real life. But to see the key, the user could easily read the source code right? Thats what i dont want them to be able to do. How do i sort of encrypt this (key = "what ever key") to something unreadable in the source code.
If i was a bit bad explaining, sorry, please ask me questions if needed.
You need to generate hash for the password. Here is example using hashlib:

(Jun 24, 2019 09:11 AM)Kallu609 Wrote:  You need to generate hash for the password. Here is example using hashlib:


Oh wow thats a cool function, ill try it out. Thank you.
I don't get how this is going to help with the described problem...
The user can still modify the python code, including the "== secret_hash" check. What you'd need is a server that will be running all the time, server that is supposed to receive the username/password (possibly encrypted) that will allow to download the desired content/application/python-code hidden from unauthorized people.
(Jun 24, 2019 10:23 AM)pms Wrote:  Oh wow thats a cool function, ill try it out. Thank you.
Using just sha256 for hashing the password it's not the best way, there are many websites that provides databases with sha256. I recommend to combine those algorithms, maybe add a secret string into password like this:
sha512(sha256(password) + 'mysecretstring')
Rule of thumb: client-side validation can be hacked/manipulated.

Your question "How to make my source not readable" can be rephrased as "How can I obfuscate my source". You can do that, but smart people will still be able to modify your GUI to pass the password validation. In addition, how well you will be able to obfuscate your source also depends on the programming language that you will be using.

Please note that if you choose to go this route and do server-side authentication, the (protected) data can be reverse engineered as well.

(Jun 24, 2019 10:50 AM)FoxBlood Wrote:  Using just sha256 for hashing the password it's not the best way, there are many websites that provides databases with sha256. I recommend to combine those algorithms, maybe add a secret string into password like this:
sha512(sha256(password) + 'mysecretstring')

Use bcrypt. It is an industry standard.


Possibly Related Threads...
Thread / Author Replies Views Last Post
[Python] by MiguelSanchezApr 3, 2022 02:37 AM 0 100 Apr 3, 2022 02:37 AM
Last Post: MiguelSanchez
[C] by Alberto9998Jan 28, 2016 07:14 PM 13 304 Jan 28, 2016 07:14 PM
Last Post: Alberto9998
[.NET] by UnturnedAug 17, 2014 02:37 PM 5 162 Aug 17, 2014 02:37 PM
Last Post: DBots