Skip to content
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

vlib/x/crypto: add poly1305 message authentication code (mac) in pure v #20752

Merged
merged 3 commits into from
Feb 9, 2024

Conversation

blackshirt
Copy link
Contributor

@blackshirt blackshirt commented Feb 7, 2024

This is our third attempt to contribute more broadly and usefully to the vlang community. In this pull request, we propose a new module, named poly1305, Poly1305 message authentication code (MAC) in pure v to the experimental namespaces vlib/x/crypto. See poly1305 for more detail.

This module was inspired mostly by the go version of the same module, and tries hard to keep up with the go version, but with some slight differences in places and adding some comments to the existing code to make it easier for other developers and community members to learn and read.

The differences includes:

  • Differences in the name of the public api provided, favouring the public implementation of poly1305-donna
  • Using a custom allocator in the form of a Uint192 structure representing 192 bits unsigned integer, which is fundamentally and functionally the same as in the go version, with its [3]u64. This can be extended or added to math.unsigned if needed. See custom.v for more details.
  • Using some of the structures, functions and methods from standard vlib of the math.unsigned module, this also serves as a test bed for standard vlib, especially the math.unsigned module.

So, please give us a review, feedback, criticism or suggestions would be greatly appreciated.
thanks to everyone

Update:

  • This is second effort after my bad mistakes in mistakenly-closes-pr
  • There are two issues that cannot be resolved at this time, but will be updated in the next iteration., first is about additional usage test usage test from @spytheman and the second is about using fixed-sized bytes array for key setup from @spytheman , @larpon ...
  • Btw, thanks for reviewing it ..for guide to restore it (even its hard), so i choose to reopen a new PR

New update

  • I have sent updates to this PR, at 50d98e4 with some bits of changes,
  • Add examples section in README files
  • Add an usage_test.v file to test public API ... its address some advices from @spytheman, see
  • Some bits of restructuring and make it more simple
  • Add test to incremental .update of Poly1305 instance, copied and adapted from poly1305_power_on_self_test

Copy link
Member

@spytheman spytheman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good work.

@larpon
Copy link
Contributor

larpon commented Feb 7, 2024

Thanks for contributing.

@spytheman
Copy link
Member

@blackshirt, I'll wait until usage_test.v that tests only the public API is pushed here, before merging it.

@spytheman spytheman marked this pull request as draft February 8, 2024 17:29
@blackshirt
Copy link
Contributor Author

blackshirt commented Feb 9, 2024

@blackshirt, I'll wait until usage_test.v that tests only the public API is pushed here, before merging it.

i have sent updates to this PR, at 50d98e4

@blackshirt
Copy link
Contributor Author

Good work.

Good work.

Thank guys ..

@spytheman spytheman marked this pull request as ready for review February 9, 2024 08:18
@spytheman spytheman merged commit ce7780a into vlang:master Feb 9, 2024
42 checks passed
@blackshirt blackshirt deleted the add_poly1305 branch February 9, 2024 10:07
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