public KeyProtector(char[] password) throws NoSuchAlgorithmException {
  int i, j;
  if (password == null) {
    throw new IllegalArgumentException("password can't be null");
  }
  md=MessageDigest.getInstance(DIGEST_ALG);
  passwdBytes=new byte[password.length * 2];
  for (i=0, j=0; i < password.length; i++) {
    passwdBytes[j++]=(byte)(password[i] >> 8);
    passwdBytes[j++]=(byte)password[i];
  }
}

public KeyProtector ( char [ ] password ) throws NoSuchAlgorithmException { int i , j ; if ( password == null ) { throw new IllegalArgumentException ( "password can't be null" ) ; } md = MessageDigest . getInstance ( DIGEST_ALG ) ; passwdBytes = new byte [ password . length * 2 ] ; for ( i = 0 , j = 0 ; i < password . length ; i ++ ) { passwdBytes [ j ++ ] = ( byte ) ( password [ i ] > > 8 ) ; passwdBytes [ j ++ ] = ( byte ) password [ i ] ; } }
creates an instance of this class , and initializes it with the given password . < p > the password is expected to be in printable ascii . normal rules for good password selection apply : at least seven characters , mixed case , with punctuation encouraged . phrases or words which are easily guessed , for example by being found in dictionaries , are bad .
