Poly1305

Purpose

Poly1305arrow-up-right is a fast one-time message authentication code (MAC). It takes a 256-bit key that can only be used once and produces a 128-bit tag.

triangle-exclamation

Usage

ComputeTag

Fills a span with a tag computed from a message and a one-time key.

Poly1305.ComputeTag(Span<byte> tag, ReadOnlySpan<byte> message, ReadOnlySpan<byte> oneTimeKey)

Exceptions

ArgumentOutOfRangeExceptionarrow-up-right

tag has a length not equal to TagSize.

ArgumentOutOfRangeExceptionarrow-up-right

oneTimeKey has a length not equal to KeySize.

CryptographicExceptionarrow-up-right

The tag could not be computed.

VerifyTag

Verifies that a tag is correct in constant time for a given message and one-time key. It returns true if the tag is valid and false otherwise.

Exceptions

ArgumentOutOfRangeExceptionarrow-up-right

tag has a length not equal to TagSize.

ArgumentOutOfRangeExceptionarrow-up-right

oneTimeKey has a length not equal to KeySize.

IncrementalPoly1305

Provides support for computing a tag from several messages and a one-time key.

Exceptions

ArgumentOutOfRangeExceptionarrow-up-right

oneTimeKey has a length not equal to KeySize.

ArgumentOutOfRangeExceptionarrow-up-right

tag has a length not equal to TagSize.

CryptographicExceptionarrow-up-right

The tag could not be computed.

InvalidOperationExceptionarrow-up-right

Cannot update after finalizing or finalize twice (without reinitializing).

ObjectDisposedExceptionarrow-up-right

The object has been disposed.

Constants

These are used for validation and/or save you defining your own constants.

Notes

triangle-exclamation
triangle-exclamation
triangle-exclamation
triangle-exclamation
circle-exclamation

Last updated