Skip to content

Basically a first implementation of the chacha20 Poly1305 algorithm #90

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

Open
wants to merge 15 commits into
base: master
Choose a base branch
from

Conversation

mikerabat
Copy link

Hope this works as intendent....

Basically I implemented the base chacha20 algorithm and a poly1305 mode following the GCM mode implementation.
I need to say I did quite some rewriting on the base class (don't be mad...) to have a more leaner interface in the
cipher classes.

In addtion I rewrote the GCM part such that it works on streams too - multiple encode/decode calls are now allowed.
This was a rewrite of bug #87 based on the new base authenticator class.

I did not rewrite teh CCM stuff - simply I didn't knew how...

There are also SSE, AVX version of the chacha algorithm so I hope I managed to put it correctly in there - unfortunately I was not
successfull with a SSE/AVX version of the Poly1305 algorithm, this one is way more complicated that chacha...

Let me know what you think of the code...

MHumm and others added 14 commits April 22, 2025 21:46
Fixed the crash of issue MHumm#86 by changing GCM to use poitners instead ot TBytes and added unit test to verify the change
Same kind of change as already done to EncodeGCM
Changed GCM part of EncodeBytes as well
Added name of the CCM implementation sponsor
* Fixed bugs to get stream functions working - not yet tested
* shrinking base classes to get the extended aead functions working
  (ccm, gcm, poly1305) - not yet tested
Minor: removed debug idx variable.
@mikerabat
Copy link
Author

Added code to implement XChaCha20 as well

@MHumm
Copy link
Owner

MHumm commented Jul 22, 2025

I need to find the time to look at this over the next few weeks. Please be a bit patient! I value your contribution. Thanks for the warning about the changes in the base class. Yes, they need to be evaluated carefully.

Does your code contain unit tests?
If so did you specify the source of the test data? Best would be an official source e.g. from the original developers or from a standards body?

@mikerabat
Copy link
Author

Yes.. at least the two vectors from the original RFC. I found a bunch of test vectors here:
https://github.com/C2SP/wycheproof/blob/main/testvectors/chacha20_poly1305_test.json
do you think it is a good idea to implement them here? I would try to convert them into your own format (if possible).

This commit would also tackle the problems with the encodings - I changed the base class so it could be used in such a way. The chacha and GCM modules are already converted. Let me know what you think of that.

@MHumm
Copy link
Owner

MHumm commented Jul 22, 2025

We should try to have unit tests for as many areas of the library as possible.

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.

2 participants
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy