FileDocCategorySizeDatePackage
PassPhrase.javaAPI DocExample1329Tue Nov 18 21:52:16 GMT 2003com.darwinsys.security

PassPhrase

public class PassPhrase extends Object
Cheap, lightweight, low-security password generator. See also: java.security.*;

Fields Summary
public static final int
MIN_LENGTH
Minimum length for a decent password
protected static Random
r
The random number generator.
protected static char[]
goodChar
Constructors Summary
Methods Summary
public static java.lang.StringgetNext()


	/* Generate a Password object with a random password. */
	    
		StringBuffer sb = new StringBuffer();
		for (int i=0; i < MIN_LENGTH; i++) {
			sb.append(goodChar[r.nextInt(goodChar.length)]);
		}
		return sb.toString();
	
public static voidmain(java.lang.String[] argv)

		for (int i=0; i<20; i++) {
			System.out.println(PassPhrase.getNext());
		}