Skip to content

Accept canonical hash names in templates - #319

Closed
dajiaohuang wants to merge 2 commits into
rhash:masterfrom
dajiaohuang:fix-311-template-hash-names
Closed

dajiaohuang wants to merge 2 commits into
rhash:masterfrom
dajiaohuang:fix-311-template-hash-names

Conversation

@dajiaohuang

@dajiaohuang dajiaohuang commented Oct 2, 2026 •

Copy link
Copy Markdown
Contributor

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 4, 2026

Copy link
Copy Markdown
Owner

Commit looks good. The change requires testing.

@dajiaohuang

Copy link
Copy Markdown
Contributor Author

The requested tests are complete. The Linux/GCC 13.3 shared build passes a compiled-CLI regression for 32 canonical hash names and their dashless aliases, a known SHA-256 value, and the legacy urlname/mtime directives. The original head fails the RIPEMD-160 canonical name case; this head passes. All 26 full CLI test groups pass with SHA-NI disabled. The CI jobs for Ubuntu, PowerPC 64 and Windows also pass at this head.

@rhash

rhash commented Oct 18, 2026

Copy link
Copy Markdown
Owner

The fix is rewritten as PR #329

@rhash

rhash commented Oct 28, 2026

Copy link
Copy Markdown
Owner

Accepted with changes as 7b2801d.

@rhash rhash closed this Oct 28, 2026
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