package ige

import (
	

	
)

// NewIGEEncrypter returns an IGE cipher.BlockMode which encrypts using IGE and
// the given cipher.Block.
//
// Note: iv must contain two iv values for IGE (concatenated), otherwise this
// function will panic. See ErrInvalidIV for more information.
func ( cipher.Block,  []byte) IGE {
	if  := checkIV(, );  != nil {
		panic(.Error())
	}

	return (*igeEncrypter)(newIGE(, ))
}

type igeEncrypter ige

func ( *igeEncrypter) () int {
	return .block.BlockSize()
}

func ( *igeEncrypter) (,  []byte) {
	EncryptBlocks(.block, .iv, , )
}

// EncryptBlocks is a simple shorthand for IGE encrypting.
// Note: unlike NewIGEEncrypter, EncryptBlocks does NOT COPY iv.
// So you must not modify passed iv.
func ( cipher.Block, , ,  []byte) {
	if  := checkIV(, );  != nil {
		panic(.Error())
	}
	if len()%.BlockSize() != 0 {
		panic("src not full blocks")
	}
	if len() < len() {
		panic("len(dst) < len(src)")
	}

	 := .BlockSize()
	 := [:]
	 := [:]

	for  := 0;  < len();  +=  {
		xor.Bytes([:+:+], [:+:+], )
		.Encrypt([:+:+], [:+:+])
		xor.Bytes([:+:+], [:+:+], )

		 = [ : + : +]
		 = [ : + : +]
	}
}