package main import ( "encoding/binary" "golang.org/x/crypto/poly1305" ) func writeWithPadding(p *poly1305.MAC, b []byte) { p.Write(b) if rem := len(b) % 16; rem != 0 { var buf [16]byte padLen := 16 - rem p.Write(buf[:padLen]) } } func writeUint64(p *poly1305.MAC, n int) { var buf [8]byte binary.LittleEndian.PutUint64(buf[:], uint64(n)) p.Write(buf[:]) }