Documentation ¶
Overview ¶
Package poly1305 implements Poly1305 one-time message authentication code as specified in http://cr.yp.to/mac/poly1305-20050329.pdf.
Poly1305 is a fast, one-time authentication function. It is infeasible for an attacker to generate an authenticator for a message without the key. However, a key must only be used for a single message. Authenticating two different messages with the same key allows an attacker to forge authenticators for other messages with the same key.
Poly1305 was originally coupled with AES in order to make Poly1305-AES. AES was used with a fixed key in order to generate one-time keys from an nonce. However, in this package AES isn't used and the one-time key is specified directly.
Index ¶
Constants ¶
const TagSize = 16
The size of the poly1305 authentication tag in bytes.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Hash ¶
type Hash struct {
// contains filtered or unexported fields
}
Hash implements a Poly1305 writer interface. Poly1305 cannot used like common hash.Hash implementations, beause of using a Poly1305 key twice breaks its security. So poly1305.Hash does not support some kind of reset.
func New ¶
New returns a hash.Hash computing the poly1305 sum. Notice that Poly1305 is inseure if one key is used twice.