Just as a side note, from experience... Omit the Letter O, the number 0, the
letter I and the number 1 from any passwords you create... This causes no
end of problems when users get their password's and they still cant login
becase the mentioned letters are hard to distinguish, espicially on fonts
such as verdana, arial etc... 

I would probably use alphabet =
"ABCDEFGHJKLMNPQRSTUVWXYZ23456789abcdefghjkmnpqrstuvwxyz" to get harder to
guess passwords... This depends though on how secure you wish to make your
site...

Anyone else have any input on this issue?

Regards,
Javier

> -----Original Message-----
> From: Ang�l Stewart [mailto:[EMAIL PROTECTED]]
> Sent: Friday, May 04, 2001 10:10 PM
> To: CF-Talk
> Subject: Code Snippet:Random Password Generator(repost)
> 
> 
> From: kermit
> Subject: Code snippet - random password generator
> Date: Thu, 29 Mar 2001 16:53:21 -0800
> 
> --------------------------------------------------------------
> --------------
> ----
> 
> This script generates a random word 7 letters long plus 4 digits long.
> 
> Example code:
> 
> <cfset random_word = "">
> 
> <cfloop index="ii" from="1" to="7">
>   <cfset random_number = "#RandRange(1,26)#">
>   <cfset alphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZ">
>   <cfset random_letter = "#Mid(alphabet,random_number,1)#">
>   <cfset random_word = "#ListAppend(random_word,random_letter)#">
> </cfloop>
> 
> <cfset random_word = "#Replace(random_word, ",", "", "ALL")#">
> <cfset random_number = "#RandRange(1000,9999)#">
> <cfset password = "#random_word##random_number#">
> 
> <cfoutput>PASSWORD: <b>#password#</b></cfoutput>
> 
> --------------------------------------------------------------
> --------------
> ----
> From: Raymond B.
> Subject: RE: Code snippet - random password generator
> Date: Thu, 29 Mar 2001 18:37:14 -0800
> 
> --------------------------------------------------------------
> --------------
> ----
> 
> Why define the alphabet? Just use decimal values for the asci 
> char set.
> 
> pass = "" ;
> for (c=1; c le 7; c=c+1) {
>         pass = pass & chr(randRange(65,90)) ;
>         }
> pass = pass & randRange(1000,9999) ;
> 
> 
> That will do the exact same thing as below much more 
> efficiently, if you
> want case sensitive or nums mixed w/ chars it's just a couple extra
> rangRanges()s (you can get creative and generate one of each 
> class then
> randRange(1,3) to choose which per digit).
> 
> --------------------------------------------------------------
> --------------
> -----
> From: Jay Jennings
> Subject: RE: Code snippet - random password generator
> Date: Thu, 29 Mar 2001 18:55:39 -0800
> 
> --------------------------------------------------------------
> --------------
> ----
> 
> > Why define the alphabet? Just use decimal values for the 
> asci char set.
> 
> So, just because I'm bored, in the unrolled loop I created I 
> change the
> alphabet to Raymond's chr:
> 
> <cfset random_word = random_word & chr(randRange(65,90))>
> 
> The speed increase was fairly slight:
> 
>  Original code (executed 1000 times): 9994 ms (average)
>  Unrolled code (executed 1000 times): 1993 ms (average)
> Unrolled w/chr (executed 1000 times): 1932 ms (average)
> 
> But it looks much nicer than repeating  the alphabet in each line.
> 
> I was going to mention that when I generate passwords I tend 
> to NOT use the
> letters O, I and L and the numbers 1 and 0. Those create too many "my
> password doesn't work!" tech support calls.
> 
>  ..jj..
> --------------------------------------------------------------
> --------------
> --
> Hope this helps :)
> 
> -Gel
> 
> 
>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Structure your ColdFusion code with Fusebox. Get the official book at 
http://www.fusionauthority.com/bkinfo.cfm

Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to