cipher

package
v0.11.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 28, 2022 License: MIT Imports: 8 Imported by: 2

Documentation

Index

Constants

View Source
const GF128_FDBK byte = 0x87

Variables

This section is empty.

Functions

func NewCCM

func NewCCM(cipher goCipher.Block) (goCipher.AEAD, error)

NewCCM returns the given 128-bit, block cipher wrapped in CCM with the standard nonce length.

func NewCCMWithNonceAndTagSize

func NewCCMWithNonceAndTagSize(cipher goCipher.Block, nonceSize, tagSize int) (goCipher.AEAD, error)

https://tools.ietf.org/html/rfc3610

func NewCCMWithNonceSize

func NewCCMWithNonceSize(cipher goCipher.Block, size int) (goCipher.AEAD, error)

NewCCMWithNonceSize returns the given 128-bit, block cipher wrapped in CCM, which accepts nonces of the given length. The length must not be zero.

func NewCCMWithTagSize

func NewCCMWithTagSize(cipher goCipher.Block, tagSize int) (goCipher.AEAD, error)

NewCCMWithTagSize returns the given 128-bit, block cipher wrapped in CCM, which generates tags with the given length.

Tag sizes between 8 and 16 bytes are allowed.

Types

type CipherCreator added in v0.4.6

type CipherCreator func([]byte) (_cipher.Block, error)

type XTSBlockMode added in v0.4.6

type XTSBlockMode interface {
	// BlockSize returns the mode's block size.
	BlockSize() int

	// Encrypt encrypts or decrypts a number of blocks. The length of
	// src must be a multiple of the block size. Dst and src must overlap
	// entirely or not at all.
	//
	Encrypt(dst, src []byte, sectorNum uint64)

	// Decrypt decrypts a number of blocks. The length of
	// src must be a multiple of the block size. Dst and src must overlap
	// entirely or not at all.
	//
	Decrypt(dst, src []byte, sectorNum uint64)
}

A XTSBlockMode represents a block cipher running in a XTS mode

func NewXTS added in v0.4.6

func NewXTS(cipherFunc CipherCreator, key []byte) (XTSBlockMode, error)

NewXTS creates a Cipher given a function for creating the underlying block cipher (which must have a block size of 16 bytes). The key must be twice the length of the underlying cipher's key.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL