question: public void init ( boolean forEncryption , CipherParameters params ) throws IllegalArgumentException { if ( ! ( params instanceof ParametersWithIV ) ) { throw new IllegalArgumentException ( "Grain v1 Init parameters must include an IV" ) ; } ParametersWithIV ivParams = ( ParametersWithIV ) params ; byte [ ] iv = ivParams . getIV ( ) ; if ( iv == null || iv . length != 8 ) { throw new IllegalArgumentException ( "Grain v1 requires exactly 8 bytes of IV" ) ; } if ( ! ( ivParams . getParameters ( ) instanceof KeyParameter ) ) { throw new IllegalArgumentException ( "Grain v1 Init parameters must include a key" ) ; } KeyParameter key = ( KeyParameter ) ivParams . getParameters ( ) ; workingIV = new byte [ key . getKey ( ) . length ] ; workingKey = new byte [ key . getKey ( ) . length ] ; lfsr = new int [ STATE_SIZE ] ; nfsr = new int [ STATE_SIZE ] ; out = new byte [ 2 ] ; System . arraycopy ( iv , 0 , workingIV , 0 , iv . length ) ; System . arraycopy ( key . getKey ( ) , 0 , workingKey , 0 , key . getKey ( ) . length ) ; reset ( ) ; }
target:  Initialize a Grain v1 cipher.