core/crypto/poly1305
poly1305
Types
1Context
Context :: struct {
_r: field.Tight_Field_Element,
_a: field.Tight_Field_Element,
_s: [2]u64,
_buffer: [_BLOCK_SIZE]u8,
_leftover: int,
_is_initialized: bool,
}SourceContext is a Poly1305 instance.
Constants
2Procedures
6final
final :: proc(ctx: ^Context, dst: []u8)Sourcefinal finalizes the Context, writes the tag to dst, and calls reset on the Context.
init
init :: proc(ctx: ^Context, key: []u8)Sourceinit initializes a Context with the specified key. The key SHOULD be unique and MUST be unpredictable for each invocation.
reset
reset :: proc(ctx: ^Context)Sourcereset sanitizes the Context. The Context must be re-initialized to be used again.
sum
sum :: proc(dst: []u8, msg: []u8, key: []u8)Sourcesum 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)Sourceupdate adds more data to the Context.
verify
verify :: proc(tag: []u8, msg: []u8, key: []u8) -> (bool)Sourceverify will verify the Poly1305 tag computed with the key over msg and return true if and only if (⟺) the tag is valid. It requires that the tag is correctly sized.