crypto::poly1305
This module provides the poly1305 MAC as defined in RFC 8439.
This is a low-level module which implements cryptographic primitives. Direct use of cryptographic primitives is not recommended for non-experts, as incorrect use of these primitives can easily lead to the introduction of security vulnerabilities. Non-experts are advised to use the high-level operations available in the top-level crypto:: module.
Be advised that Hare's cryptography implementations have not been audited.
Index
Types
type key = [32]u8;
type state = struct {
mac::mac,
r: [4]u32,
h: [5]u32,
c: [16]u8,
pad: [4]u32,
cidx: size,
};
Constants
def BLOCKSZ: size = 16;
def SZ: size = 16;
Functions
fn init(p: *state, key: *key) void;
fn poly1305() state;
Types
type key
type key = [32]u8;
Poly1305 key.
type state
Show undocumented member
type state = struct {
mac::mac,
r: [4]u32,
h: [5]u32,
c: [16]u8,
pad: [4]u32,
cidx: size,
};
Constants
def BLOCKSZ
def BLOCKSZ: size = 16;
Internal block size in bytes.
def SZ
def SZ: size = 16;
Length of the resulting MAC in bytes.
Functions
fn init
fn init(p: *state, key: *key) void;
Initialises the MAC with given one time key.
fn poly1305
fn poly1305() state;
Creates a crypto::mac::mac that computes the poly1305 MAC. It needs to be initialised using init. Like the other MACs it needs to be finished using crypto::mac::finish after use.