public long depass ( final String password , final OutputStream os ) throws IOException { int offset = password . startsWith ( ENC ) ? 4 : 0 ; final ByteArrayOutputStream baos = new ByteArrayOutputStream ( ) ; final ByteArrayInputStream bais = new ByteArrayInputStream ( password . getBytes ( ) , offset , password . length ( ) - offset ) ; exec ( new AESExec ( ) { @ Override public void exec ( AES aes ) throws IOException { CipherOutputStream cos = aes . outputStream ( baos , false ) ; decode ( bais , cos ) ; cos . close ( ) ; // flush } } ) ; byte [ ] bytes = baos . toByteArray ( ) ; DataInputStream dis = new DataInputStream ( new ByteArrayInputStream ( bytes ) ) ; long time ; if ( this . getClass ( ) . getSimpleName ( ) . startsWith ( "base64" ) ) { // don't expose randomization os . write ( bytes ) ; time = 0L ; } else { int start = 0 ; for ( int i = 0 ; i < 3 ; ++ i ) { start += Math . abs ( dis . readByte ( ) ) ; } start %= 0x7 ; for ( int i = 0 ; i < start ; ++ i ) { dis . readByte ( ) ; } time = ( dis . readInt ( ) & 0xFFFF ) | ( System . currentTimeMillis ( ) & 0xFFFF0000 ) ; int minlength = dis . readByte ( ) ; if ( minlength < 0x9 ) { DataOutputStream dos = new DataOutputStream ( os ) ; for ( int i = 0 ; i < minlength ; ++ i ) { dis . readByte ( ) ; dos . writeByte ( dis . readByte ( ) ) ; } } else { int pre = ( ( Byte . SIZE * 3 + Integer . SIZE + Byte . SIZE ) / Byte . SIZE ) + start ; os . write ( bytes , pre , bytes . length - pre ) ; } } return time ; }
Decrypt a password