> -----Original Message-----
> From: Massimo, Tiziana e Federica [mailto:[EMAIL PROTECTED]
> Sent: Sunday, July 31, 2005 8:34 AM
> To: CF-Talk
> Subject: Re: random password generator
> 
> > Does anyone suggest a good random password generator for CFMX7?
> >
> > Many of the ones on the macromedia exchange are for much older versions
> of
> ColdFusion.


I've a simple one as part of my security framework.  It uses a "safe" list
of characters that should not be confused with one another (ohs and zeros,
ones and ells, etc are removed).  You can generate passwords (simply random
sequences of characters) of any length.

The CFC documentation is here:

http://www.depressedpress.com/depressedpress/Content/Development/ColdFusion/
DPLibraries/Documentation/DocViewer.cfm?Component=cfc_DepressedPress.Securit
y.DP_Security

But it's definitely overkill for just generating the passwords.  The method
definition itself is:

<cffunction name="generatePassword"
         hint="Generates a random password from a list of distinct
characters."
         returntype="String"
         access="Public"
         output="No">
      <!--- Input Arguments --->
   <cfargument name="Length" type="Numeric" required="no"
            hint="The length of the password to be returned." />
      <!--- Set Local Scope --->
   <cfset var local = StructNew() />

      <!--- Set the length --->
   <cfif NOT IsDefined("arguments.Length")>
      <cfset arguments.Length = variables.Password_DefaultLen>   
   </cfif>

   <cfset local.CharSet = "QWERTYUPASDFGHJKLZXCVBNM23456789" />
   <cfset local.CurChar = "" />
   <cfset local.Password = "" />

   <cfloop from="1" to="#arguments.Length#" index="local.Cnt">
      <cfset local.CurChar = Mid(local.CharSet, RandRange(1,
Len(local.CharSet)), 1) />
      <cfset local.Password = local.Password & local.CurChar />
   </cfloop>

      <!--- Return the Password --->
   <cfreturn local.Password />

</cffunction>

The only thing it expects from it's host is "variables.Password_DefaultLen"
(which sets the default length of passwords if the "Length" argument isn't
passed.

Jim Davis





~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Logware (www.logware.us): a new and convenient web-based time tracking 
application. Start tracking and documenting hours spent on a project or with a 
client with Logware today. Try it for free with a 15 day trial account.
http://www.houseoffusion.com/banners/view.cfm?bannerid=67

Message: http://www.houseoffusion.com/lists.cfm/link=i:4:213345
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

Reply via email to