Generated from Manticore v1.1.6 • 388 packages. View on pkg.go.dev

cfb8

import "github.com/TheManticoreProject/Manticore/crypto/aes/cfb8"

Package cfb8 implements the 8-bit cipher feedback mode (CFB8) of operation for any block cipher, as defined by NIST SP 800-38A. Go’s standard library exposes only full-block CFB (and deprecates it), whereas several Microsoft protocols — notably the Netlogon secure channel of MS-NRPC ([MS-NRPC] 3.1.4.4.1) — rely on the 8-bit-segment variant, in which the shift register advances one octet per plaintext octet.

The implementations satisfy cipher.Stream, so they compose with any cipher.Block (AES, DES, …) exactly like the other stream modes in crypto/cipher. They are validated against the NIST SP 800-38A F.3.7/F.3.8 (CFB8-AES128) known-answer vectors.

Index

func NewDecrypter

func NewDecrypter(block cipher.Block, iv []byte) cipher.Stream

NewDecrypter returns a cipher.Stream that decrypts with the given block cipher in CFB8 mode using the supplied IV. The IV length must equal the cipher’s block size, otherwise NewDecrypter panics.

Parameters:

  • block: The block cipher to run in CFB8 mode (e.g. an AES cipher.Block).
  • iv: The initialisation vector; its length must equal block.BlockSize().

Returns:

  • cipher.Stream: A stream that decrypts via XORKeyStream.

func NewEncrypter

func NewEncrypter(block cipher.Block, iv []byte) cipher.Stream

NewEncrypter returns a cipher.Stream that encrypts with the given block cipher in CFB8 mode using the supplied IV. The IV length must equal the cipher’s block size, otherwise NewEncrypter panics.

Parameters:

  • block: The block cipher to run in CFB8 mode (e.g. an AES cipher.Block).
  • iv: The initialisation vector; its length must equal block.BlockSize().

Returns:

  • cipher.Stream: A stream that encrypts via XORKeyStream.