• Advertisement
Sign in to follow this  

Converting password to number

This topic is 1424 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.
 
[CreatePassword]
PasswordCreate$ = ""
length = 0
PasswordCreateText = 0
PasswordCreatePro$ = ""
cls
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]
 
[EndOfTest]
notice "Program closed"
end
 
Paul

Share this post


Link to post
Share on other sites
Advertisement

"Never roll your own crypto"

http://security.stackexchange.com/questions/18197/why-shouldnt-we-roll-our-own

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