This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Java in General and the fly likes Password Generation Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "Password Generation" Watch "Password Generation" New topic

Password Generation

Pol Appan
Ranch Hand

Joined: Aug 26, 2004
Posts: 144

I have a user information creation form in JSP. After the user succesfully creates his account an email will be send to him with a password.

What is the best way of generating an alphanumeric password?

Any help is highly appreciated.



Never take anything for granted because you never know when you will lose it
Jeff Albertson
Ranch Hand

Joined: Sep 16, 2005
Posts: 1780

There is no emoticon for what I am feeling!
Pol Appan
Ranch Hand

Joined: Aug 26, 2004
Posts: 144
Thanks a lot and much appreciated.
Stan James
(instanceof Sidekick)
Ranch Hand

Joined: Jan 29, 2003
Posts: 8791
A user-friendly technique is to find a large spelling dictionary somewhere on the web with thousands of words. Then pick two or three at random to make a password. I can still remember my CompuServe password from the early 80's: "WATER BOLDLY." I'd never remember QR1bA39u.

Still I have a routine to do just what was shown above. It accepts an argument with the valid characters, eg "BCDFGHJKLMPQRSTVWXYZ0123456789". Note I left out the vowels to avoid randomly generating some insult to the user's parentage though users from Qwhlgm are still at risk. You might also leave out 1 and 0 to avoid confusion with I and O.
[ September 23, 2005: Message edited by: Stan James ]

A good question is never answered. It is not a bolt to be tightened into place but a seed to be planted and to bear more seed toward the hope of greening the landscape of the idea. John Ciardi
It is sorta covered in the JavaRanch Style Guide.
subject: Password Generation
Similar Threads
Initializing DataSource
How to Promt User for Three Times Password Check?
FORM auth method
DIGEST auth-method
Help...How much preparation do I need for SCJP1.4 ?