Skip to content

Optimize and harden GetHashCode with Aes#83

Merged
benaadams merged 1 commit intomainfrom
hash-quality
Jan 16, 2026
Merged

Optimize and harden GetHashCode with Aes#83
benaadams merged 1 commit intomainfrom
hash-quality

Conversation

@benaadams
Copy link
Member

Replaces the previous GetHashCode logic with a hardware-accelerated approach using AES instructions on supported platforms (x64 and ARM), and improves the fallback CRC32C-based hash with better mixing and finalization. This enhances hash quality, performance, and diffusion for UInt256 values.

Replaces the previous GetHashCode logic with a hardware-accelerated approach using AES instructions on supported platforms (x64 and ARM), and improves the fallback CRC32C-based hash with better mixing and finalization. This enhances hash quality, performance, and diffusion for UInt256 values.
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR optimizes the UInt256.GetHashCode implementation by introducing hardware-accelerated AES-based hashing for x64 and ARM platforms while improving the fallback CRC32C implementation with better mixing and finalization.

Changes:

  • Adds AES hardware intrinsics support for x64 and ARM platforms to compute hash codes using encryption operations
  • Improves the CRC32C fallback path with distinct seeds per component and better mixing/finalization
  • Introduces using aliases (x64 and Arm) for intrinsics namespaces

@benaadams benaadams changed the title Optimize and harden UInt256.GetHashCode implementation Optimize and harden GetHashCode with Aes Jan 16, 2026
@benaadams benaadams merged commit 9eddc80 into main Jan 16, 2026
17 checks passed
@benaadams benaadams deleted the hash-quality branch January 16, 2026 16:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants