static byte[] encryptData(byte[] password,int size,byte[] data){
  try {
    Cipher c=Cipher.getInstance(ENCRYPT_DATA_ALGORITHM);
    c.init(Cipher.ENCRYPT_MODE,new SecretKeySpec(password,SECRET_KEY_ALGORITHM),CBC_SALT_DATA);
    c.update(new byte[]{(byte)(size >> 24),(byte)(size >> 16),(byte)(size >> 8),(byte)(size)});
    return c.doFinal(data);
  }
 catch (  Exception e) {
    throw new IllegalStateException(ENCRYPT_DATA_ALGORITHM + " is not available",e);
  }
}

static byte [ ] encryptData ( byte [ ] password , int size , byte [ ] data ) { try { Cipher c = Cipher . getInstance ( ENCRYPT_DATA_ALGORITHM ) ; c . init ( Cipher . ENCRYPT_MODE , new SecretKeySpec ( password , SECRET_KEY_ALGORITHM ) , CBC_SALT_DATA ) ; c . update ( new byte [ ] { ( byte ) ( size > > 24 ) , ( byte ) ( size > > 16 ) , ( byte ) ( size > > 8 ) , ( byte ) ( size ) } ) ; return c . doFinal ( data ) ; } catch ( Exception e ) { throw new IllegalStateException ( ENCRYPT_DATA_ALGORITHM + " is not available" , e ) ; } }
encrypt key ( does not use salting , so the encryption result is the same for the same input )
