Web Analytics Made Easy -
StatCounter Password Stuff - CodingForum


No announcement yet.

Password Stuff

  • Filter
  • Time
  • Show
Clear All
new posts

  • Password Stuff

    I understand how to prompt for a password and such, but don't understand how to create them, randomly, and then verify if it is good or not. If someone could take the time to explain it to me in a post or maybe knows a tutorial I could learn from that would be great.

    Thanks in advance!!

  • #2
    well, you can't really do that sort of password work with javascript. for that, you need a database of some kind.

    what happens, is a random string is generated. at a guess, i'd say that's done by taking a random number, and saying that's the length of the string. then, for every character in that string, you take another random number, and say that this is the ascii value of that character in the string.

    for example, first, we make the random number 7. this is the length of our password. then, for 0 (counting always starts at 0), we take another random number, 97, which is 'a'. then we pick another random number for 1, 69, which is 'E'. so, we do that 5 more times, and we have 7 random characters, making a randomly generated string.

    then, supposing we had one, we'd enter the chosen username into the database, and enter the password in next to it. that way, when the user comes back, we can check and see if that username is in the database, and then match their input, against the password in the database.

    javascript isn't capable of that, because it can't interact with databases. when you use javascript for password, then you have to come up with the passwords yourself, and anyone can find out what they are, by looking at the source code.
    bluemood | devedge | devmo | MS Dev Library | WebMonkey | the Guide

    i am a loser geek, crazy with an evil streak,
    yes i do believe there is a violent thing inside of me.