api

package
v0.0.0-...-7ce890d Latest Latest
Warning

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

Go to latest
Published: Sep 10, 2019 License: AGPL-3.0 Imports: 0 Imported by: 0

Documentation

Overview

Package api provides the ChaCha20 implementation abstract interface.

Index

Constants

View Source
const (
	// BlockSize is the size of a ChaCha20 block in bytes.
	BlockSize = 64

	// StateSize is the size of the ChaCha20 state as 32 bit unsigned words.
	StateSize = 16

	// HashSize is the size of the HChaCha output in bytes.
	HashSize = 32

	// HNonceSize is the HChaCha20 nonce size in bytes.
	HNonceSize = 16

	// Sigma0 is the first word of the ChaCha constant.
	Sigma0 = uint32(0x61707865)

	// Sigma1 is the second word of the ChaCha constant.
	Sigma1 = uint32(0x3320646e)

	// Sigma2 is the third word of the ChaCha constant.
	Sigma2 = uint32(0x79622d32)

	// Sigma3 is the fourth word of the ChaCha constant.
	Sigma3 = uint32(0x6b206574)
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Implementation

type Implementation interface {
	// Name returns the name of the implementation.
	Name() string

	// Blocks calculates the ChaCha20 blocks.  If src is not nil, dst will
	// be set to the XOR of src with the key stream, otherwise dst will be
	// set to the key stream.
	Blocks(x *[StateSize]uint32, dst, src []byte, nrBlocks int)

	// HChaCha calculates the HChaCha20 hash.
	//
	// Note: `dst` is guaranteed to be HashSize bytes.
	HChaCha(key, nonce []byte, dst []byte)
}

Implementation is a ChaCha20 implementation

Jump to

Keyboard shortcuts

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