package igeimport ()// 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(, ))}typeigeEncrypterigefunc ( *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()) }iflen()%.BlockSize() != 0 {panic("src not full blocks") }iflen() < len() {panic("len(dst) < len(src)") } := .BlockSize() := [:] := [:]for := 0; < len(); += {xor.Bytes([:+:+], [:+:+], ) .Encrypt([:+:+], [:+:+])xor.Bytes([:+:+], [:+:+], ) = [ : + : +] = [ : + : +] }}
The pages are generated with Goldsv0.6.7. (GOOS=linux GOARCH=amd64)
Golds is a Go 101 project developed by Tapir Liu.
PR and bug reports are welcome and can be submitted to the issue list.
Please follow @Go100and1 (reachable from the left QR code) to get the latest news of Golds.