poly

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

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

Go to latest
Published: Jun 28, 2017 License: MIT Imports: 2 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

Polynomial authentication schemes

A polynomial authenticator is basically a message authentication scheme. Therefore the polynomial authenticator takes a secret key and a message of arbitrary size and computes a fixed size authentication tag.

It is critical for the security of the authenticator that the one key is never used for more than one message - so never reuse a key. Authenticating two different messages with the same key allows an attacker to forge messages at will.

This package provides a general interface for polynomial authenticators and natively supports two commonly used polynomials:

  • GHASH used by the AES-GCM AEAD construction
  • Poly1305 used by the ChaCha20Poly1305 AEAD construction

Those both polynomial authenticators are used in TLS.

Install

Install in your GOPATH: go get github.com/aead/poly

Performance

For GHASH benchmarks see: GHASH implementation
For Poly1305 benchmarks see: Poly1305 implementation

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Hash

type Hash interface {
	// Write adds more data to the running authenticator.
	// This function should return a non-nil error if a call
	// to Write happens after a call to Sum. So it is not possible
	// to compute the checksum and than add more data.
	io.Writer

	// Size returns the number of bytes Sum will append.
	Size() int

	// Sum computes and appends the hash to b and returns the resulting slice.
	// It is safe to call this function multiple times.
	Sum(b []byte) []byte
}

Hash defines a common interface for polynomial authenticators.

func NewPoly1305

func NewPoly1305(key [32]byte) Hash

NewPoly1305 returns a new Hash computing a poly1305 authenticator.

Jump to

Keyboard shortcuts

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