code: public void enpass(final String password, final OutputStream os) throws IOException {
  		final ByteArrayOutputStream baos = new ByteArrayOutputStream();
  		DataOutputStream dos = new DataOutputStream(baos);
  		byte[] bytes = password.getBytes();
  		if(this.getClass().getSimpleName().startsWith("base64")) { // don't expose randomization
  			dos.write(bytes);
  		} else {
  			
  			Random r = new SecureRandom();
  			int start = 0;
  			byte b;
  			for(int i=0;i<3;++i) {
  				dos.writeByte(b=(byte)r.nextInt());
  				start+=Math.abs(b);
  			}
  			start%=0x7;
  			for(int i=0;i<start;++i) {
  				dos.writeByte(r.nextInt());
  			}
  			dos.writeInt((int)System.currentTimeMillis());
  			int minlength = Math.min(0x9,bytes.length);
  			dos.writeByte(minlength); // expect truncation
  			if(bytes.length<0x9) {
  				for(int i=0;i<bytes.length;++i) {
  					dos.writeByte(r.nextInt());
  					dos.writeByte(bytes[i]);
  				}
  				// make sure it's long enough
  				for(int i=bytes.length;i<0x9;++i) {
  					dos.writeByte(r.nextInt());
  				}
  			} else {
  				dos.write(bytes);
  			}
  		}
  		
  		// 7/21/2016 jg add AES Encryption to the mix
  		exec(new AESExec() {
  			@Override
  			public void exec(AES aes) throws IOException {
  				CipherInputStream cis = aes.inputStream(new ByteArrayInputStream(baos.toByteArray()), true);
  				try {
  					encode(cis,os);
  				} finally {
  					os.flush();
  					cis.close();
  				}
  			}
  		});
  		synchronized(ENC) {
  		}
  	}
docs: Create an encrypted password, making sure that even short passwords have a minimum length.
  
  @param password
  @param os
  @throws IOException