tc_poly1305
The Poly1305 one-time message authentication code (RFC 8439), constant time,
over the Mac and MacInit contracts of
tc_macs. Raw Poly1305 with a
caller-supplied 32-byte one-time key; Poly1305-AES is not included. no_std,
no allocator, no unsafe, Rust 1.85 or later.
Types
Poly1305— the MAC; implementstc_macs::Macandtc_macs::MacInitfor anytc_macs::KeyParams.BLOCK_BYTES,KEY_BYTES,TAG_BYTES— the block, key and tag lengths: 16, 32 and 16 bytes.
Usage
[]
= "0.1.0"
= "0.1.0"
use ;
use ;
let mut mac = new;
mac.init.expect;
mac.update.expect;
let mut tag = ;
mac.do_final.expect;
Security
A Poly1305 key must never authenticate two messages, so do_final consumes
it: the key is wiped and the MAC refuses input until it is initialized with a
fresh one. This is stricter than Bouncy Castle, which keeps the key. Compare a
received tag in constant time. Poly1305 is constant time, and it wipes the
key and the message state on drop; a clone is another copy of the key.
License
Licensed under either the MIT license or the Apache License, Version 2.0, at your option.