Jump to content
  • Advertisement
Sign in to follow this  

Converting password to number

This topic is 2057 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi all,
As part of the login process for my game I am storing the username / password in a file. To protect this and stop people using the password I have written some code to take the password, convert this to ASCII code, preform two mathematical operations and save this to a file.
Having undertaken some testing of my code I have found a couple of things:
1) Entering "Paul" produces the same result as "luaP"
2) Entering "Lisa" produces the same result as "Bart".
Paul = 180730
luaP = 180730
Lisa = 178093
Bart = 178093
Here is the code I have written. This is taken from my game but changed slightly to work as a standalone program.
PasswordCreate$ = ""
length = 0
PasswordCreateText = 0
PasswordCreatePro$ = ""
Input "Enter a password: "; PasswordCreate$
    length = len(PasswordCreate$)
    for A = 1 to length
        PasswordCreatePro$ =  mid$(PasswordCreate$, A)
        PasswordCreateText = PasswordCreateText + asc(PasswordCreatePro$)
    next A
PasswordCreateText = PasswordCreateText  * 293
PasswordCreateText = PasswordCreateText + 62944
Print ""; PasswordCreateText
open "PassWordChecker_Temp.spf" for append as #UC
print #UC, ""; PasswordCreate$;  " = "; PasswordCreateText
close #UC
input "? "; RunChoice$
if RunChoice$ = "q" then gosub [EndOfTest]
gosub [CreatePassword]
notice "Program closed"

Share this post

Link to post
Share on other sites

"Never roll your own crypto"


If this is just for fun, or just for you and your friends or whatever, it's fun to learn how things work so doing your own crypto will be fine. Go ahead and use MD5 all you want. But if this is for something that is going on the internet, or for real users DO NOT make your own crypto algorithm. 

EDIT: Just to add, look up scrypt as well!

Edited by kiteflyingmonkey

Share this post

Link to post
Share on other sites

Thanks for the replies.


This is for a game I am making which is for my own use with a view to letting other people download it and play it if they want.


I am limited by the programming language I am using (JustBasic) so I am trying to make it the best / most secure I can within the limits of JustBasic.

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!