Skip to content

Fix 311 template hash names - #329

Open
rhash wants to merge 3 commits into
masterfrom
fix-311-template-hash-names
Open

rhash wants to merge 3 commits into
masterfrom
fix-311-template-hash-names

Conversation

@rhash

@rhash rhash commented Oct 18, 2026

Copy link
Copy Markdown
Owner

Reworked PR #319 by @dajiaohuang.

Original descritption:
Names printed by --list-hashes, such as RIPEMD-160, are not recognized as template directives and are emitted literally. Match hash names case-insensitively after removing dashes from both the input and hash-table name. Initialize the normalization buffer so legacy-directive comparisons cannot inspect unset bytes, and cast input bytes to unsigned char before case conversion.

Closes #311.

Validation: compiled the actual shared-library CLI on Ubuntu with GCC 13.3 and SHA-NI disabled. The added executable-level regression verifies all 32 public hash names against their dashless aliases, SHA-256 of abc, and existing urlname/mtime directives. The original implementation fails at RIPEMD-160, returning the directive literally; the fix passes. All 26 groups of the full existing CLI suite pass, and git diff --check passes. Run the new standalone regression with python3 tests/test_template_hash_names.py ./rhash; it is not automatically wired into the existing shell suite. Other platforms and SHA-NI-enabled builds were not exercised for this PR.

@rhash

rhash commented Oct 18, 2026

Copy link
Copy Markdown
Owner Author

Introduced print_hash_info.cmp_name field to simplify directive name comparision in printf_name_to_id().

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.

rhash 1.4.6 won't output a hash (see details for which)

2 participants