Skip to content

Fast Poly1305 MAC implementation #27

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 3 commits into from
Closed

Conversation

timw
Copy link
Contributor

@timw timw commented Jul 17, 2013

Fast implementation of Poly1305 message authentication code, with tests and JCE registrations.

Poly1305 was designed by D.J. Bernstein and is used in the nacl and libsodium libraries (and various ports of these).
The fast polynomial calculation in this implementation is adapted from the public domain 'poly1305-donna-unrolled' C implementation by Andrew M (@floodyberry) (https://github.com/floodyberry/poly1305-donna) - primarily adapting to Java signed integer arithmetic.
JCE registrations are provided for Poly1305-* for 128 bit AES era block ciphers (AES, Serpent, Twofish etc.)
Test cases generated from poly1305 reference and nacl implementations included.

Throughput tests for MACs included to compare Poly1305 performance against reference implementation and other MACs.
Throughput testing of this implementation gives a result of about 12.7/7.3/7.0 cycles per byte for 16/256/8192 byte messages (on a 2.5GHz Core i5 Macbook Pro laptop).
This compares well with 176/29/19 for HMAC-SHA1, 43/33/31 for AES-CMAC, 120/44/37 for AES-GMAC, 124/20/15 for Skein-MAC, 23/14/13 for (unoptimised) SipHash.
It's also substantially faster than the Poly1305 'ref' implementation used in simple Java ports, which records 90/76/76 c/b in Java.

timw added 3 commits July 17, 2013 23:12
Poly1305 was designed by D.J. Bernstein.
The fast polynomial calculation in this implementation is adapted from the public domain 'poly1305-donna-unrolled' C implementation by Andrew M (@floodyberry) (https://github.com/floodyberry/poly1305-donna).
JCE registrations are provided for Poly1305-* for 128 bit AES era block ciphers (AES, Serpent, Twofish etc.)
Test cases generated from poly1305 reference and nacl implementations included.
Throughput tests for Macs included to compare Poly1305 performance against reference implementation and other Macs.
@ghost ghost assigned bcgit Sep 7, 2013
@peterdettman
Copy link
Collaborator

Merged. Thanks, Tim.

@bcgit bcgit removed their assignment May 26, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants