chacha20

package
v0.0.0-...-34d48bb Latest Latest
Warning

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

Go to latest
Published: Jul 7, 2016 License: LGPL-3.0 Imports: 6 Imported by: 0

Documentation

Overview

Package chacha20 implements the ChaCha stream cipher and the ChaCha20Poly1305 AEAD construction described in RFC 7539.

ChaCha20 uses a 32 bit counter and produces 64 byte keystream per iteration. Following ChaCha20 can en/decrypt up to 2^32 * 64 byte for one key-nonce combination. Notice that one specific key-nonce combination must be unique for all time.

Index

Constants

View Source
const NonceSize = 12

The size of the ChaCha20 nonce in bytes.

View Source
const TagSize = poly1305.TagSize

The max. size of the auth. tag for the ChaCha20Poly1305 AEAD cipher in bytes.

Variables

This section is empty.

Functions

func NewChaCha20Poly1305

func NewChaCha20Poly1305(key *[32]byte) cipher.AEAD

NewChaCha20Poly1305 returns a cipher.AEAD implementing the ChaCha20Poly1305 construction specified in RFC 7539 with a 128 bit auth. tag.

func NewChaCha20Poly1305WithTagSize

func NewChaCha20Poly1305WithTagSize(key *[32]byte, tagsize int) (cipher.AEAD, error)

NewChaCha20Poly1305WithTagSize returns a cipher.AEAD implementing the ChaCha20Poly1305 construction specified in RFC 7539 with arbitrary tag size. The tagsize must be between 1 and the TagSize constant.

func NewCipher

func NewCipher(nonce *[NonceSize]byte, key *[32]byte) cipher.Stream

NewCipher returns a new cipher.Stream implementing the ChaCha20 stream cipher. The nonce must be unique for one key for all time.

func XORKeyStream

func XORKeyStream(dst, src []byte, nonce *[NonceSize]byte, key *[32]byte, counter uint32)

XORKeyStream crypts bytes from src to dst using the given key, nonce and counter. Src and dst may be the same slice but otherwise should not overlap. If len(dst) < len(src) this function panics.

Types

This section is empty.

Directories

Path Synopsis
Package chacha implements some low level functions of the ChaCha cipher family.
Package chacha implements some low level functions of the ChaCha cipher family.

Jump to

Keyboard shortcuts

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