Hey!

Password generating algorithm?  You mean like this one below:

Sans adieu,
Danny

 //Generate a random password
 private String htpasswd(java.util.Date date) {
  String[] selectionarray = new String[63];
  selectionarray[1]="A";
  selectionarray[2]="B";
  selectionarray[3]="C";
  selectionarray[4]="D";
  selectionarray[5]="E";
  selectionarray[6]="F";
  selectionarray[7]="G";
  selectionarray[8]="H";
  selectionarray[9]="I";
  selectionarray[10]="J";
  selectionarray[11]="K";
  selectionarray[12]="L";
  selectionarray[13]="M";
  selectionarray[14]="N";
  selectionarray[15]="O";
  selectionarray[16]="P";
  selectionarray[17]="Q";
  selectionarray[18]="R";
  selectionarray[19]="S";
  selectionarray[20]="T";
  selectionarray[21]="U";
  selectionarray[22]="V";
  selectionarray[23]="W";
  selectionarray[24]="X";
  selectionarray[25]="Y";
  selectionarray[26]="Z";
  selectionarray[27]="0";
  selectionarray[28]="1";
  selectionarray[29]="2";
  selectionarray[30]="3";
  selectionarray[31]="4";
  selectionarray[32]="5";
  selectionarray[33]="6";
  selectionarray[34]="7";
  selectionarray[35]="8";
  selectionarray[36]="9";
  selectionarray[37]="a";
  selectionarray[38]="b";
  selectionarray[39]="c";
  selectionarray[40]="d";
  selectionarray[41]="e";
  selectionarray[42]="f";
  selectionarray[43]="g";
  selectionarray[44]="h";
  selectionarray[45]="i";
  selectionarray[46]="j";
  selectionarray[47]="k";
  selectionarray[48]="l";
  selectionarray[49]="m";
  selectionarray[50]="n";
  selectionarray[51]="o";
  selectionarray[52]="p";
  selectionarray[53]="q";
  selectionarray[54]="r";
  selectionarray[55]="s";
  selectionarray[56]="t";
  selectionarray[57]="u";
  selectionarray[58]="v";
  selectionarray[59]="w";
  selectionarray[60]="x";
  selectionarray[61]="y";
  selectionarray[62]="z";
  java.lang.StringBuffer nbuf = new java.lang.StringBuffer();
  java.util.Random rnum = new java.util.Random(date.getTime());
  int i=0, j=0;
  double d = 0;
  //System.out.println("Generating password...");
  do {
   {
    int rands = -1;
    d = rnum.nextDouble();
    rands = new Double(d*63).intValue();
    //System.out.println("d is "+d+" rands is "+rands);
    j = rands+1;
   }
    nbuf.append(selectionarray[j]);
    i++;
  } while (i<8);
  return nbuf.toString();
 }


Matt Penner wrote:

> Take a look at the help files on http://jakarta.apache.org/ or pick up a good
> Apache book such as the new one from Sybex.  If you want strictly servlet or
> HTTP based authentication then the ever popular Jason Hunter book has an entire
> chapter on the most common methods.  He has it laid out very nicely on exactly
> what you need to do.
>
> As far as password generating algorithms you usually can do it with a set of
> possible characters and random statements or a mathematical function.  You can
> also look on Google and I'm sure you'll find tons.
>
> Matt
>
> Quoting anoop <[EMAIL PROTECTED]>:
>
> > Is there some sort of Login authentication (user name, password)  that
> > can
> > be used with Apache/Tomcat..Can somebody show me how to use it.
> > Also is anybody aware abt some password generating algorithms...
> >
> > Thanks to all..
> > anoop
> > ----- Original Message -----
> > From: "shashi kanth goud" <[EMAIL PROTECTED]>
> > To: <[EMAIL PROTECTED]>
> > Sent: Saturday, December 01, 2001 10:56 AM
> > Subject: Re: File reader
> >
> >
> > it would be better if u use Properties class. I hope this helps u
> > Regards
> > Shashi
> >
> > On Wed, 28 Nov 2001 Gardner Monte wrote :
> >
> >
> >
> > ___________________________________________________________________________
> > To unsubscribe, send email to [EMAIL PROTECTED] and include in the
> > body
> > of the message "signoff SERVLET-INTEREST".
> >
> > Archives: http://archives.java.sun.com/archives/servlet-interest.html
> > Resources:
> > http://java.sun.com/products/servlet/external-resources.html
> > LISTSERV Help: http://www.lsoft.com/manuals/user/user.html
> >
> > ___________________________________________________________________________
> > To unsubscribe, send email to [EMAIL PROTECTED] and include in the
> > body
> > of the message "signoff SERVLET-INTEREST".
> >
> > Archives: http://archives.java.sun.com/archives/servlet-interest.html
> > Resources:
> > http://java.sun.com/products/servlet/external-resources.html
> > LISTSERV Help: http://www.lsoft.com/manuals/user/user.html
> >
>
> ___________________________________________________________________________
> To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
> of the message "signoff SERVLET-INTEREST".
>
> Archives: http://archives.java.sun.com/archives/servlet-interest.html
> Resources: http://java.sun.com/products/servlet/external-resources.html
> LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

Reply via email to