def poly1305_mac
import bend-collections@1.0.0.0/spec/crypto/poly1305.bend as Poly1305import Base
113# poly1305_mac(msg, key): r = clamp(key[0..16]), s = key[16..32];
114# a = 0, absorb every block, a += s; the tag is num_to_16_le_bytes(a).
115def poly1305_mac(+key: List<&2, U32>, +msg: List<&2, U32>) -> List<&2, U32>:
116 +r = le_num(clamp(prefix(16n, key)))
117 +s = le_num(prefix(16n, suffix(16n, key)))
118 le_bytes(16n, Nat.add(absorb(blocks(List.length(&2, U32, msg), msg), r, 0n), s))