Search code examples
javaauto-populatewpa

Populate java array with all allowable ASCII chars for WPA password


I am trying to create a random WPA password generator using java to give me as secure of a Wifi password as possible, which can be changed when I desire.

Is there a way to quickly populate an array with all of the characters which would be allowed to be used in a WPA(2) password as opposed to manually entering the chars one by one?


Solution

  • int pwLength = 8;
    Random numberGenerator = new Random();
    char[] pw = new char[pwLength];
    for(int i = 0; i<pwLength; i++){
        pw[i] = numberGenerator.nextInt(95) + 32;
    }