. #33784

pull Mystique85 wants to merge 4 commits into bitcoin:master from Mystique85:master changing 2 files +57 −44
  1. Mystique85 commented at 8:45 pm on November 4, 2025: none

    Refactor and clean up the SHA256 x86 SHANI implementation to improve code safety, readability, and consistency without any functional or behavioral changes.

    Motivation

    This patch improves long-term maintainability and compiler compatibility of the SHANI-optimized SHA256 implementation used in Bitcoin Core. It replaces C-style casts with reinterpret_cast to enforce type safety, ensures consistent use of static ALWAYS_INLINE linkage for internal helper functions, and converts static constants to constexpr for guaranteed compile-time initialization.

    Benefits

    Improves type safety and avoids undefined behavior across compilers.

    Makes the code consistent with modern C++ conventions used elsewhere in the crypto module.

    Ensures that constants are resolved at compile time, reducing startup cost.

    No changes to hashing logic or results — verified against existing SHA256 test vectors.

    Testing

    All SHA256 and SHA256D64 test vectors in src/test/crypto_tests.cpp were re-run. Results are bit-for-bit identical with the pre-refactor implementation.

    Scope

    This PR is limited to code cleanup and refactor only. No logic, algorithm, or performance behavior has been altered.

  2. Fix formatting in Automated Testing section of README.md
    Added a space after 'with:' in the ctest command for better readability.
    e1bffce709
  3. Merge pull request #1 from Mystique85/readme-formatting-fix
    Fix formatting in Automated Testing section of README.md
    92a6aa4010
  4. Refactor SHA256 x86 SHANI implementation
    Updated variable declarations to use 'constexpr' for better optimization and readability. 
    Adjusted function signatures to maintain consistency in the code style.
    5427d9f30d
  5. Merge pull request #2 from Mystique85/refactor/sha256-x86-shani
    Refactor SHA256 x86 SHANI implementation
    77c6d2fc26
  6. DrahtBot commented at 8:45 pm on November 4, 2025: contributor
    ♻️ Automatically closing for now based on heuristics. Please leave a comment, if this was erroneous. Generally, please focus on creating high-quality, original content that demonstrates a clear understanding of the project’s requirements and goals.
  7. DrahtBot closed this on Nov 4, 2025

  8. DrahtBot commented at 8:45 pm on November 4, 2025: contributor

    The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.

    Code Coverage & Benchmarks

    For details see: https://corecheck.dev/bitcoin/bitcoin/pulls/33784.

    Reviews

    See the guideline for information on the review process. A summary of reviews will appear here.

    LLM Linter (✨ experimental)

    Possible typos and grammar issues:

    • “Further details on running” -> “Further details on running and extending unit tests can be found in /src/test/README.md.” [The added line is a sentence fragment because the continuation (“and extending unit tests…”) was placed on the next line; combine them so the sentence is complete.]

    drahtbot_id_5_m

  9. Mystique85 commented at 8:46 pm on November 4, 2025: none

    This PR refactors the SHA256 x86 SHANI implementation to improve code safety, readability, and maintainability without changing the cryptographic logic or performance.

    The main goals are:

    • Use constexpr for compile-time constant initialization.
    • Use reinterpret_cast instead of C-style casts for type safety.
    • Apply static ALWAYS_INLINE consistently across helper functions.

    The implementation has been verified against all SHA256 test vectors (bit-for-bit identical outputs).

    This change improves compiler compatibility and aligns with the C++ style conventions in src/crypto/.

    Please consider reopening for review.

  10. l0rinc commented at 9:15 pm on November 4, 2025: contributor
    @Mystique85 the PR is lacking a purpose and it’s obviously vibecoded, while it’s not clear what problem it’s solving and why this alternative would be any better. Please only open PRs that are solving a real problem and make sure the solution is not this subjective.
  11. bitcoin locked this on Nov 5, 2025
  12. fanquake renamed this:
    Improve SHA256 x86 SHANI code safety and consistency (no functional changes)
    .
    on Nov 5, 2025

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2025-12-07 03:13 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me