package core:crypto/poly1305

⌘K
Ctrl+K
or
/

    Overview

    package poly1305 implements the Poly1305 one-time MAC algorithm.

    See: https://datatracker.ietf.org/doc/html/rfc8439

    Index

    Types (1)
    Constants (2)
    Variables (0)

    This section is empty.

    Procedures (6)
    Procedure Groups (0)

    This section is empty.

    Types

    Context ¶

    Context :: struct {
    	_r:              field_poly1305.Tight_Field_Element,
    	_a:              field_poly1305.Tight_Field_Element,
    	_s:              [2]u64,
    	_buffer:         [16]u8,
    	_leftover:       int,
    	_is_initialized: bool,
    }
     

    Context is a Poly1305 instance.

    Related Procedures With Parameters

    Constants

    KEY_SIZE ¶

    KEY_SIZE :: 32
     

    KEY_SIZE is the Poly1305 key size in bytes.

    TAG_SIZE ¶

    TAG_SIZE :: 16
     

    TAG_SIZE is the Poly1305 tag size in bytes.

    Variables

    This section is empty.

    Procedures

    final ¶

    final :: proc(ctx: ^Context, dst: []u8) {…}
     

    final finalizes the Context, writes the tag to dst, and calls reset on the Context.

    init ¶

    init :: proc(ctx: ^Context, key: []u8) {…}
     

    init initializes a Context with the specified key. The key SHOULD be unique and MUST be unpredictable for each invocation.

    reset ¶

    reset :: proc(ctx: ^Context) {…}
     

    reset sanitizes the Context. The Context must be re-initialized to be used again.

    sum ¶

    sum :: proc(dst, msg, key: []u8) {…}
     

    sum will compute the Poly1305 MAC with the key over msg, and write the computed tag to dst. It requires that the dst buffer is the tag size.

    The key SHOULD be unique and MUST be unpredictable for each invocation.

    update ¶

    update :: proc(ctx: ^Context, data: []u8) {…}
     

    update adds more data to the Context.

    verify ¶

    verify :: proc(tag, msg, key: []u8) -> bool {…}
     

    verify will verify the Poly1305 tag computed with the key over msg and return true iff the tag is valid. It requires that the tag is correctly sized.

    Procedure Groups

    This section is empty.

    Source Files

    Generation Information

    Generated with odin version dev-2024-12 (vendor "odin") Windows_amd64 @ 2024-12-06 21:12:12.401686600 +0000 UTC