package mirage-crypto

  1. Overview
  2. Docs

The poly1305 message authentication code

type 'a iter = ('a -> unit) -> unit
type t

Represents a running mac computation, suitable for appending inputs.

val mac_size : int

mac_size is the size of the output.

val empty : key:string -> t

empty is the empty context with the given key.

  • raises Invalid_argument

    if key is not 32 bytes.

val feed : t -> string -> t

feed t msg adds the information in msg to t.

val feedi : t -> string iter -> t

feedi t iter feeds iter into t.

val get : t -> string

get t is the mac corresponding to t.

val mac : key:string -> string -> string

mac ~key msg is the all-in-one mac computation: get (feed (empty ~key) msg).

val maci : key:string -> string iter -> string

maci ~key iter is the all-in-one mac computation: get (feedi (empty ~key) iter).

val mac_into : key:string -> (string * int * int) list -> bytes -> dst_off:int -> unit

mac_into ~key datas dst dst_off computes the mac of datas.

OCaml

Innovation. Community. Security.