Skip to content

Add _blake2 consts#8053

Merged
youknowone merged 2 commits into
RustPython:mainfrom
ShaharNaveh:blake2-consts
Jun 10, 2026
Merged

Add _blake2 consts#8053
youknowone merged 2 commits into
RustPython:mainfrom
ShaharNaveh:blake2-consts

Conversation

@ShaharNaveh

@ShaharNaveh ShaharNaveh commented Jun 7, 2026

Copy link
Copy Markdown
Contributor

Summary

Summary by CodeRabbit

  • Bug Fixes
    • Added Blake2 cryptographic algorithm parameter constants required for proper initialization and configuration of hash operations.

@coderabbitai

coderabbitai Bot commented Jun 7, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yml

Review profile: CHILL

Plan: Pro

Run ID: d00b1118-cde9-4885-99b2-e7474612ebac

📥 Commits

Reviewing files that changed from the base of the PR and between 51c97b9 and 492a55e.

⛔ Files ignored due to path filters (1)
  • Lib/test/test_hashlib.py is excluded by !Lib/**
📒 Files selected for processing (1)
  • crates/stdlib/src/blake2.rs

📝 Walkthrough

Walkthrough

This PR exposes nine module-level constants in the _blake2 Python module: one GIL minimum size constant and eight Blake2 parameter size constants (salt, person, max-key, max-digest sizes for both BLAKE2B and BLAKE2S variants). No function implementations are modified.

Changes

Blake2 Parameter Constants

Layer / File(s) Summary
Python-exposed Blake2 and GIL constants
crates/stdlib/src/blake2.rs
Module-level #[pyattr] constants are added to the _blake2 module, exposing GIL_MINSIZE and Blake2 parameter sizes (BLAKE2B_SALT_SIZE, BLAKE2B_PERSON_SIZE, BLAKE2B_MAX_KEY_SIZE, BLAKE2B_MAX_DIGEST_SIZE, BLAKE2S_SALT_SIZE, BLAKE2S_PERSON_SIZE, BLAKE2S_MAX_KEY_SIZE, BLAKE2S_MAX_DIGEST_SIZE) as Python-accessible attributes.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

Poem

🐰 Constants hop and skip with glee,
Blake2 sizes now for all to see!
Salt, person, key, digest so fine—
Module exports in perfect line!
GIL minsize joins the cryptic spree,

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The pull request title accurately and concisely describes the main change: adding constants to the _blake2 module.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions

github-actions Bot commented Jun 7, 2026

Copy link
Copy Markdown
Contributor

📦 Library Dependencies

The following Lib/ modules were modified. Here are their dependencies:

[x] lib: cpython/Lib/hashlib.py
[x] test: cpython/Lib/test/test_hashlib.py (TODO: 7)

dependencies:

  • hashlib

dependent tests: (141 tests)

  • hashlib: test_hashlib test_hmac test_smtplib test_tarfile test_unicodedata test_urllib2_localnet
    • hmac:
      • imaplib: test_imaplib
      • secrets: test_secrets
      • smtplib: test_smtpnet
    • poplib: test_poplib
    • random: test_asyncio test_bisect test_buffer test_builtin test_bz2 test_collections test_complex test_context test_dbm_dumb test_decimal test_deque test_descr test_devpoll test_dict test_dummy_thread test_email test_float test_functools test_heapq test_importlib test_int test_io test_itertools test_logging test_long test_lzma test_math test_mmap test_numeric_tower test_ordered_dict test_poll test_posixpath test_pow test_pprint test_queue test_random test_regrtest test_richcmp test_selectors test_set test_shutil test_signal test_socket test_sort test_statistics test_strtod test_struct test_sys test_thread test_threading test_tokenize test_traceback test_unparse test_uuid test_weakref test_zipfile test_zlib test_zstd
      • email.generator: test_email
      • email.utils: test_httpservers test_urllib2
      • tempfile: test_argparse test_ast test_asyncio test_bytes test_cmd_line test_compile test_compileall test_concurrent_futures test_contextlib test_cprofile test_csv test_ctypes test_dis test_doctest test_embed test_ensurepip test_faulthandler test_filecmp test_fileinput test_generated_cases test_genericalias test_importlib test_inspect test_launcher test_linecache test_mailbox test_modulefinder test_ntpath test_os test_pathlib test_peg_generator test_pickle test_pkg test_pkgutil test_posix test_pstats test_py_compile test_pydoc test_runpy test_site test_string_literals test_subprocess test_support test_sys_settrace test_tabnanny test_tempfile test_termios test_threadedtempfile test_tomllib test_turtle test_urllib test_urllib_response test_venv test_winconsoleio test_zipapp test_zipfile64 test_zoneinfo
    • urllib.request: test_http_cookiejar test_sax test_ssl test_urllib2net test_urllibnet
      • pathlib: test_dbm_sqlite3 test_importlib test_pathlib test_tomllib test_tools test_winapi test_zipfile
    • uuid:
      • wave: test_wave

Legend:

  • [+] path exists in CPython
  • [x] up-to-date, [ ] outdated

@ShaharNaveh ShaharNaveh marked this pull request as ready for review June 7, 2026 08:24
@youknowone youknowone merged commit c864885 into RustPython:main Jun 10, 2026
27 checks passed
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