private byte[] padPassword(byte[] password){
  if (password == null) {
    password=new byte[0];
  }
  byte[] padded=new byte[32];
  final int numContributingPasswordBytes=password.length > padded.length ? padded.length : password.length;
  System.arraycopy(password,0,padded,0,numContributingPasswordBytes);
  if (password.length < padded.length) {
    System.arraycopy(PW_PADDING,0,padded,password.length,padded.length - password.length);
  }
  return padded;
}

private byte [ ] padPassword ( byte [ ] password ) { if ( password == null ) { password = new byte [ 0 ] ; } byte [ ] padded = new byte [ 32 ] ; final int numContributingPasswordBytes = password . length > padded . length ? padded . length : password . length ; System . arraycopy ( password , 0 , padded , 0 , numContributingPasswordBytes ) ; if ( password . length < padded . length ) { System . arraycopy ( PW_PADDING , 0 , padded , password . length , padded . length - password . length ) ; } return padded ; }
pad a password as per step 1 of algorithm 3 . 2 of the pdf reference version 1 . 7
