ctr

package
v0.0.0-...-811459a Latest Latest
Warning

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

Go to latest
Published: Mar 12, 2017 License: ISC Imports: 8 Imported by: 0

Documentation

Overview

Package ctr supports ctr encryption - this implementation is authenticated with crypto/hmac using sha256

Index

Constants

View Source
const (
	// NonceSize to use for nonces
	NonceSize = aes.BlockSize
	// MACSize is the output size of HMAC-SHA-256
	MACSize = 32
	// CKeySize - Cipher key size - AES-256
	CKeySize = 32
	// MKeySize - HMAC key size - HMAC-SHA-256
	MKeySize = 32
	// KeySize to use for keys, 64 bytes
	KeySize = CKeySize + MKeySize
)

Variables

This section is empty.

Functions

func Decrypt

func Decrypt(key, ciphertext []byte) ([]byte, error)

Decrypt decrypts ciphertext using the given key

func Encrypt

func Encrypt(key, plaintext []byte) ([]byte, error)

Encrypt encrypts plaintext using the given key with CTR encryption

func Key

func Key() (*[KeySize]byte, error)

Key returns a pointer to an array of bytes with the given KeySize

Types

type Cipher

type Cipher struct {
}

Cipher to implement the BlockCipher interface

func New

func New() *Cipher

New returns a new ctr cipher

func (*Cipher) Decrypt

func (c *Cipher) Decrypt(key, ciphertext []byte) ([]byte, error)

Decrypt implements the BlockCipher interface

func (*Cipher) Encrypt

func (c *Cipher) Encrypt(key, plaintext []byte) ([]byte, error)

Encrypt implements the BlockCipher interface

func (*Cipher) KeySize

func (c *Cipher) KeySize() int

KeySize implements the BlockCipher interface

Jump to

Keyboard shortcuts

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