Skip to content

Rewrite and cleanup HACL* blake2module.c #135004

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
picnixz opened this issue Jun 1, 2025 · 0 comments
Closed

Rewrite and cleanup HACL* blake2module.c #135004

picnixz opened this issue Jun 1, 2025 · 0 comments
Assignees
Labels
extension-modules C modules in the Modules dir type-refactor Code refactoring (with no changes in behavior)

Comments

@picnixz
Copy link
Member

picnixz commented Jun 1, 2025

Some parts of blake2module.c have duplicated bits, and most of the file has lines exceeding 100 characters. I wouldn't bother about lines exceeding 80 characters, but here we're talking about lines that exceed my (laptop) screen.

When we switched from our implementation of BLAKE-2 to the HACL*, I mentioned cleaning it up, but I forgot about this.

Linked PRs

@picnixz picnixz self-assigned this Jun 1, 2025
@picnixz picnixz added extension-modules C modules in the Modules dir type-refactor Code refactoring (with no changes in behavior) labels Jun 1, 2025
picnixz added a commit that referenced this issue Jun 9, 2025
* Cleanup imports and update module docstring.
* Simplify detection of SIMD support.
* Correctly guard `update()` cases.
* Rewrite `py_blake2b_or_s_new` and rename it to `py_blake2_new`.
* Rewrite `blake2_blake2b_copy_locked` and `py_blake2_clear`.
* Refactor computations of `digest` and `hexdigest`.
* Simplify `py_blake2b_get_name` and `py_blake2b_get_block_size`.
* Add `hacl_get_blake2_info` to extract static BLAKE-2 information.
   This new helper is used by `py_blake2b_get_digest_size`, but can
   be later used to expose `key_length` more easily.
@picnixz picnixz closed this as completed Jun 9, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
extension-modules C modules in the Modules dir type-refactor Code refactoring (with no changes in behavior)
Projects
None yet
Development

No branches or pull requests

1 participant