Skip to content

Add hash command (md5, sha1, sha256) - #158

Closed
jay23606 wants to merge 2 commits into
codepiyusss:mainfrom
jay23606:pr-go/94-feature-add-a-hash-command
Closed

jay23606 wants to merge 2 commits into
codepiyusss:mainfrom
jay23606:pr-go/94-feature-add-a-hash-command

Conversation

@jay23606

Copy link
Copy Markdown
Contributor

Closes #94

What

Adds a hash subcommand, fixit hash TEXT [--algo {md5,sha1,sha256}], which prints the hex digest of the text (UTF-8 encoded). The default algorithm is sha256; --algo is limited with argparse choices.

  • fixit/hashing.py (new): hash_text(text, algo="sha256") returns the digest as a string and raises ValueError for an unsupported algorithm. It does not print.
  • fixit/cli.py: run_hash handler, hash entry in COMMAND_TABLE, and the subparser in build_parser.
  • tests/test_hashing.py (new): md5 of hello equals 5d41402abc4b2a76b9719d911017c592; sha256 is the default; md5 of the empty string; unsupported algorithm raises; the CLI prints the default and md5 digests; the CLI rejects an unknown --algo.

Testing

  • python -m pytest tests/test_hashing.py -q: 7 passed.
  • python -m pytest -q: 131 passed.
  • The WSL Debian environment has no pytest installed, and I did not install packages, so the suite was run with Windows Python only. CI will run it on the full matrix.

Regression test: untested: a small feature has no test that fails before the change

Fixes #94

@jay23606
jay23606 marked this pull request as ready for review November 21, 2026 00:38

@codepiyusss codepiyusss left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

@jay23606, please close this PR and open another one because this PR currently has merge conflicts and is failing CI workflow checks.
Before resubmitting, sync/rebase your branch onto the latest base branch (or merge the latest base branch into your feature branch), resolve all conflicts, then run the test suite locally and push the corrected branch. A freshly opened PR is preferable so the workflows run on a clean, up-to-date branch.

@codepiyusss codepiyusss added the bug Something returns a wrong result label Nov 21, 2026
@jay23606 jay23606 closed this Nov 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something returns a wrong result

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Feature: add a hash command

2 participants