package ige

import (
	

	
)

// NewIGEDecrypter returns an IGE cipher.BlockMode which decrypts 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 (*igeDecrypter)(newIGE(, ))
}

type igeDecrypter ige

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

func ( *igeDecrypter) (,  []byte) {
	DecryptBlocks(.block, .iv, , )
}

// DecryptBlocks is a simple shorthand for IGE decrypting.
// Note: unlike NewIGEDecrypter, DecryptBlocks 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([:+:+], [:+:+], )
		.Decrypt([:+:+], [:+:+])
		xor.Bytes([:+:+], [:+:+], )

		 = [ : +]
		 = 
	}
}