code: @Override
  	public void init(Key key, IvParameterSpec iv) throws InvalidKeyException {
  		if(!(key instanceof SecretKey))
  			throw new InvalidKeyException();
  		int ivLength = iv.getIV().length;
  		if(key.getEncoded().length < MIN_KEY_SIZE || key.getEncoded().length < ivLength)
  			throw new InvalidKeyException("Key must be longer than " + MIN_KEY_SIZE + " bytes and key must be longer than IV.");
  		this.key = key.getEncoded();
  		this.iv = iv;
  		prehash = Misc.XORintoA(this.key.length == ivLength ? iv.getIV() : Arrays.copyOf(iv.getIV(), this.key.length), this.key);
  		blockNo = 0;
  		buffer = new ByteQueue(getBlockSize()*2);
  		buffer.setResizable(true);
  		cfg = true;
  	}
docs: Initializes the cipher with key and iv
  @param iv An initialization vector to use for the cipher.
  @param key A key to encrypt with.
  @throws InvalidKeyException