public static void main ( String [ ] args ) { try { if ( args . length == 0 ) { System . err . println ( "Usage java " + Cryption . class . getName ( ) + " <text>" ) ; return ; } final String decryptedPassword ; if ( args [ 0 ] . equals ( "-d" ) ) { if ( args . length > 2 ) { StringBuilder p = new StringBuilder ( ) ; for ( int i = 1 ; i < args . length ; i ++ ) { if ( i > 1 ) p . append ( ' ' ) ; p . append ( args [ i ] ) ; } decryptedPassword = p . toString ( ) ; } else { decryptedPassword = args [ 1 ] ; } System . out . println ( getCanonical ( ) . decryptText ( decryptedPassword ) ) ; } else System . out . println ( CRYPTION_PREFIX + getCanonical ( ) . encryptText ( args [ 0 ] ) ) ; } catch ( Exception e ) { e . printStackTrace ( ) ; } }
Encrypt a given values