Random password





2
Date Submitted Sun. Sep. 9th, 2007 12:15 PM
Revision 1 of 1
Beginner bala
Tags ASP | VBSCRIPT
Comments 0 comments

If you're using passwords of any type on your site, it is best to keep them random. That way they cannot be easily guessed at by intruders.

First, it's good to know a little about ASCII characters. Every character your keyboard can type is actually represented by a number. So the letter A is represented by 65. The letter Z is represented by 90. So all you need to do is generate a series of random numbers, each number between 65 and 90. That would give you a way to find the equivalent letters.

If you want to include numbers too, those are found between spots 48 and 57. I wouldn't use the spots between 57 and 65 - those are odd characters like colons.




So let's say you want to create a 7 character password that contains a random assortment of letters and numbers. You could do something like this:


Randomize()
PassLen = 0
CurrPass = ""

do while PassLen < 7
CurrLtr = Int((42 * Rnd()) + 48)
if CurrLtr < 57 or CurrLtr > 65 then
CurrPass = CurrPass & Chr(CurrLtr)
PassLen = PassLen + 1
end if
loop
.

 
b]If you're using passwords of any type on your site, it is best to keep them random. That way they cannot be easily guessed at by intruders.[/b] [eek] [bigsmile]

bala kumaran

Thanks
beebala

Comments

There are currently no comments for this snippet.

Voting

Votes Up


Syntax Master dannyboy
Scripter Pio

Votes Down