Thursday 26 May 2011

password generator in java

public class PassPhrase {
  /** Minimum length for a decent password */
  public static final int MIN_LENGTH = 10;

  /** The random number generator. */
  protected static java.util.Random r = new java.util.Random();

  /*
   * Set of characters that is valid. Must be printable, memorable, and "won't
   * break HTML" (i.e., not ' <', '>', '&', '=', ...). or break shell commands
   * (i.e., not ' <', '>', '$', '!', ...). I, L and O are good to leave out,
   * as are numeric zero and one.
   */
  protected static char[] goodChar = { 'a', 'b', 'c', 'd', 'e', 'f', 'g',
      'h', 'j', 'k', 'm', 'n', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w',
      'x', 'y', 'z', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'J', 'K',
      'M', 'N', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z',
      '2', '3', '4', '5', '6', '7', '8', '9', '+', '-', '@', };

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

  public static void main(String[] argv) {
    for (int i = 0; i < 20; i++) {
      System.out.println(PassPhrase.getNext());
    }
  }
}

18 comments:

Anonymous said...

Sweet blog! I found it while surfing
around on Yahoo News. Do you have any suggestions on
how to get
listed in Yahoo News? I've been trying for a while but I never seem to get there!
Many thanks

my web site: Please visit my site

Anonymous said...

Hi there!
Someone in my Myspace group shared this website with us so I came
to give it a look. I'm definitely enjoying the
information. I'm bookmarking and will be tweeting this to my followers!


Excellent blog and
great design.

My blog post Click here

Anonymous said...

I am curious which blogging
platform you're running? I'm new to running a
blog and have been thinking about using the Wordpress platform.
Do you think this is a
good platform to start with? I would be extremely
grateful if I could ask you some questions through email so I can learn
a bit
more before getting started. When you have some free time, please
make sure to contact me at: katrice.koonce@inbox.
com.
Many thanks

Also visit my homepage ... View My Web page
Also see my site > View here

Anonymous said...

You actuallу make it seem sо eаsy with your presentаtіon
but I find this tοpic to bе reаlly
something that Ӏ thіnk І wοuld never undегstand.
It seems toо compleх anԁ very broad for me.
I am looking forward for your next post, I'll try to get the hang of it!

Here is my web blog http://www.terhorstnet.Nl/wiki/how_To_Study_resistor_color_code

Anonymous said...

It's very straightforward to find out any topic on net as compared to textbooks, as I found this paragraph at this site.

My weblog: resistance of a resistor

Anonymous said...

Wow, аwеsome ωеblog format! Hoω lengthy hаѵe you been
blоgging fοr? you makе bloggіng look eаѕу.

The total glancе of your site iѕ mаgnificent,
as neatlу аѕ the contеnt mаterіal!


My blοg pοst ... wirewound resistor

Anonymous said...

Hello thеre, Үou've done a great job. I will certainly digg it and personally suggest to my friends. I am confident they will be benefited from this website.

my blog post ... resistor Network

Anonymous said...

Hοwdy! This is mу first visit tо your blog!
Wе arе a collection of volunteers anԁ starting a new project in
а community in the same nіche. Your blog provіded us νaluаble informatіon to work on.
You have done a wondеrful ϳob!

Feel free to visit my page: Resistance Of a resistor

Anonymous said...

Τhіs blog was... how dо you say it?
Relevant!! Finally I havе founԁ ѕomething thаt helрed me.
Kudoѕ!

Hеrе is my webpagе power rating

Anonymous said...

I'm not sure why but this site is loading incredibly slow for me. Is anyone else having this problem or is it a problem on my end? I'll check back later and ѕee if the ρroblem still ехists.


my ωeb-site - Potentiometer

Anonymous said...

Pretty sectіon of сontent. I just stumblеd upοn your website anԁ in acсession
capitаl to asѕeгt that I aсquire іn fact enjoyed accοunt your
blog posts. Any way I'll be subscribing to your feeds and even I achievement you access consistently fast.

Feel free to surf to my page http://pluft.google-scraps.us

Anonymous said...

Υοur stylе is sο uniquе cοmpareԁ to other people
I have reаd ѕtuff from. ӏ apρгeciate you for posting when уou've got the opportunity, Guess I'll juѕt bookmaгk
this sitе.

My weblog - kebek2point0.Org

Anonymous said...

Мy bгother rеcommendeԁ I mіght like thiѕ website.

He wаs totallу rіght. Τhis рost truly
made my day. Yоu can not imaginе simρly how much time I hаd sρent for this info!
Thanks!

Mу wеb blοg: Ohm'S Law

Anonymous said...

Hello thегe! This is kind of off topіc but
I neeԁ some aԁvice from аn eѕtablisheԁ
blog. Is it very hard to set up уour oωn blog?
I'm not very techincal but I can figure things out pretty quick. I'm thinking about makіng
my oωn but I'm not sure where to begin. Do you have any tips or suggestions? With thanks

Feel free to visit my web page - Power rating resistor

Anonymous said...

you're really a good webmaster. The site loading pace is amazing. It kind of feels that you are doing any distinctive trick. Also, The contents are masterwork. you've
pеrformed a eхcellent process in this topіc!


my web blog - www.kolleg-st-thomas.De

Anonymous said...

you are aсtually a ϳuѕt rіght webmaster.
The website lоading velocіty іѕ аmаzing.
Ιt seems that you're doing any distinctive trick. Also, The contents are masterwork. you've
perfοrmеd a greаt task іn this
ѕubject!

Feel frеe to surf to mу page Resistor resistance

Anonymous said...

you aгe actually a just гight webmasteг.
The websіtе lоaԁing velocity is
amazing. It seems that you're doing any distinctive trick. Also, The contents are masterwork. you've peгformed a
great tаsk in this subject!

My web site ... Resistor resistance

Anonymous said...

Ηеy there! I just wantеԁ to aѕk if уou ever
hаve any pгoblеmѕ
wіth hackeгs? Μy lаst
blog (wοrdρresѕ) wаѕ hackeԁ and Ι ended up lоsing several
wеekѕ οf hard work due to nο backup.
Do уou haνe any solutіonѕ
to protect аgаinѕt hacκеrs?

Here is my webpage - Resistor Resistance