tendermint: github.com/tendermint/tendermint/crypto/xchacha20poly1305 Index | Files

package xchacha20poly1305

import "github.com/tendermint/tendermint/crypto/xchacha20poly1305"

Package xchacha20poly1305 creates an AEAD using hchacha, chacha, and poly1305 This allows for randomized nonces to be used in conjunction with chacha.


Package Files



const (
    // KeySize is the size of the key used by this AEAD, in bytes.
    KeySize = 32
    // NonceSize is the size of the nonce used with this AEAD, in bytes.
    NonceSize = 24
    // TagSize is the size added from poly1305
    TagSize = 16
    // MaxPlaintextSize is the max size that can be passed into a single call of Seal
    MaxPlaintextSize = (1 << 38) - 64
    // MaxCiphertextSize is the max size that can be passed into a single call of Open,
    // this differs from plaintext size due to the tag
    MaxCiphertextSize = (1 << 38) - 48

func HChaCha20 Uses

func HChaCha20(out *[32]byte, nonce *[16]byte, key *[32]byte)

HChaCha20 generates 32 pseudo-random bytes from a 128 bit nonce and a 256 bit secret key. It can be used as a key-derivation-function (KDF).

func New Uses

func New(key []byte) (cipher.AEAD, error)

New returns a new xchachapoly1305 AEAD

Package xchacha20poly1305 imports 5 packages (graph). Updated 2019-11-19. Refresh now. Tools for package owners.