Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Code Snippets / Password encryption

Author
Message
Cloggy
20
Years of Service
User Offline
Joined: 31st Oct 2004
Location: Rayleigh, Essex
Posted: 28th Mar 2005 07:14
I've seen a few people writing password encryption code and have decided totry my hand at it.

This is what I've come up with.



You specify a keyword that remains constant in your program. This keyword is encrypted by using a password you specifiy. The encrypted text is then stored to a file.

To check your password the encrypted text is decrypted by using your password and is checked against the programs keyword. If these match the password must also match.

It's obviously not as good as the high level encryption available, but is should be enough to put off most casual hackers.

Cheers,

Cloggy
thread surfer
20
Years of Service
User Offline
Joined: 8th Apr 2005
Location:
Posted: 10th Apr 2005 22:08
Could you write one of these that works with DBC?
UnderLord
21
Years of Service
User Offline
Joined: 2nd Aug 2003
Location:
Posted: 10th May 2005 14:54
I didnt read all the code but did you encrypt the text file the program writes to store the password? because any "hacker" with common sense would go to find a text file first heh.

When we talk to god, we're praying. When god talks to us, we're schizophrenic.
Schizophrenic beats eating alone.
Cloggy
20
Years of Service
User Offline
Joined: 31st Oct 2004
Location: Rayleigh, Essex
Posted: 10th May 2005 17:05 Edited at: 10th May 2005 17:10
The password isn't stored anywhere. When you set the password a keyword is encrypted using the supplied password and stored in the file.

When you want to check the password the file is read and the keyword decrypted using the supplied password. If the keyword matches that stored in the program the password is correct.

Does that make sense?

Here is a slightly updated version with the keyword being randomly generated to make it harder to find if you hex edit the program.



Cheers
Cloggy
IanM
Retired Moderator
22
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 10th May 2005 22:16
Did you know that you never need to decrypt to compare passwords? Just compare the encrypted versions rather than decrypting and comparing.

This also allows you to write an encryption routine that is one-way, ie cannot be decrypted. This is the way that the standard Unix login scheme does it.

*** Coming soon - Network Plug-in - Check my site for info ***
For free Plug-ins and source code http://www.matrix1.demon.co.uk

Login to post a reply

Server time is: 2025-05-16 08:49:31
Your offset time is: 2025-05-16 08:49:31