cipher

package module
v0.0.0-...-bf803c7 Latest Latest
Warning

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

Go to latest
Published: Apr 30, 2019 License: MIT Imports: 5 Imported by: 0

README

cipher

cipher

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNotFullBlock = errors.New("input not full block")

Functions

func IV

func IV(size int) []byte

IV Size bytes

Types

type AEAD

type AEAD struct {
	cipher.AEAD
}

AEAD packaging to simplify operations

func (*AEAD) Decrypt

func (a *AEAD) Decrypt(ciphertext []byte) (plaintext []byte, err error)

Decrypt AEAD decrypts data.

func (*AEAD) Encrypt

func (a *AEAD) Encrypt(plaintext []byte) (ciphertext []byte, err error)

Encrypt AEAD encrypts data.

type Block

type Block struct {
	cipher.Block
}

func (*Block) Decrypt

func (a *Block) Decrypt(ciphertext []byte) (plaintext []byte, err error)

Decrypt Block decrypts data.

func (*Block) Encrypt

func (a *Block) Encrypt(plaintext []byte) (ciphertext []byte, err error)

Encrypt Block encrypts data.

type BlockMode

type BlockMode struct {
	DeBlockMode cipher.BlockMode
	EnBlockMode cipher.BlockMode
}

func (*BlockMode) Decrypt

func (c *BlockMode) Decrypt(ciphertext []byte) (plaintext []byte, err error)

func (*BlockMode) Encrypt

func (c *BlockMode) Encrypt(plaintext []byte) (ciphertext []byte, err error)

type Cipher

type Cipher interface {
	Encrypt(plaintext []byte) (ciphertext []byte, err error)
	Decrypt(ciphertext []byte) (plaintext []byte, err error)
}

func CBC

func CBC(b cipher.Block) (Cipher, error)

CBC Cipher Block Chaining Mode

func CBCWithIV

func CBCWithIV(b cipher.Block, iv []byte) (Cipher, error)

CBCWithIV Cipher Block Chaining Mode

func CFB

func CFB(b cipher.Block) (Cipher, error)

CFB Cipher FeedBack Mode

func CFBWithIV

func CFBWithIV(b cipher.Block, iv []byte) (Cipher, error)

CFBWithIV Cipher FeedBack Mode

func CTR

func CTR(b cipher.Block) (Cipher, error)

CTR CounTeR Mode

func CTRWithIV

func CTRWithIV(b cipher.Block, iv []byte) (Cipher, error)

CTRWithIV CounTeR Mode

func GCM

func GCM(b cipher.Block) (Cipher, error)

GCM Galois/Counter Mode

func NewAEAD

func NewAEAD(aead cipher.AEAD) Cipher

func NewBlock

func NewBlock(block cipher.Block) Cipher

func NewBlockMode

func NewBlockMode(deBlockMode, enBlockMode cipher.BlockMode) Cipher

func NewPKCS7Padding

func NewPKCS7Padding(i int) Cipher

func NewPipeline

func NewPipeline(cipher ...Cipher) Cipher

func NewStream

func NewStream(deStream, enStream cipher.Stream) Cipher

func NewZeroPadding

func NewZeroPadding(i int) Cipher

func OFB

func OFB(b cipher.Block) (Cipher, error)

OFB Output FeedBack Mode

func OFBWithIV

func OFBWithIV(b cipher.Block, iv []byte) (Cipher, error)

OFBWithIV Output FeedBack Mode

type PKCS7Padding

type PKCS7Padding int

func (PKCS7Padding) Decrypt

func (p PKCS7Padding) Decrypt(ciphertext []byte) (plaintext []byte, err error)

func (PKCS7Padding) Encrypt

func (p PKCS7Padding) Encrypt(plaintext []byte) (ciphertext []byte, err error)

type Pipeline

type Pipeline []Cipher

func (Pipeline) Decrypt

func (a Pipeline) Decrypt(ciphertext []byte) (plaintext []byte, err error)

Decrypt Block decrypts data.

func (Pipeline) Encrypt

func (a Pipeline) Encrypt(plaintext []byte) (ciphertext []byte, err error)

Encrypt Block encrypts data.

type Stream

type Stream struct {
	DeStream cipher.Stream
	EnStream cipher.Stream
}

func (*Stream) Decrypt

func (c *Stream) Decrypt(ciphertext []byte) (plaintext []byte, err error)

func (*Stream) Encrypt

func (c *Stream) Encrypt(plaintext []byte) (ciphertext []byte, err error)

type ZeroPadding

type ZeroPadding int

func (ZeroPadding) Decrypt

func (p ZeroPadding) Decrypt(ciphertext []byte) (plaintext []byte, err error)

func (ZeroPadding) Encrypt

func (p ZeroPadding) Encrypt(plaintext []byte) (ciphertext []byte, err error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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