tidy-hash-lite 1.0.1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,17 @@
1
+ # Changelog
2
+
3
+ What changed in hash-lite, newest first.
4
+
5
+ ## 1.0.1 - unreleased
6
+
7
+ - The package is now named `tidy-hash-lite` on PyPI, because PyPI did not allow `hash-lite`. The Python module and the `hash-lite` command keep their names. A `tidy-hash-lite` command was added so `uvx tidy-hash-lite` works.
8
+ - Shorter MCP Registry description.
9
+
10
+ ## 1.0.0 - 2026-11-10
11
+
12
+ - First release.
13
+ - Hashes text (as UTF-8) or local file bytes with SHA-256, SHA-1, MD5 and optional SHA-512. Hex and Base64 are included by default.
14
+ - `--algorithms` picks which hashes to compute. `--no-base64` turns off the Base64 forms.
15
+ - `--json` gives one clean object for scripts and AI agents. `--quiet` hides the tip line.
16
+ - A free MCP server with two read-only tools: `hash_text` and `hash_file`.
17
+ - Needs Python 3.10 or newer.
@@ -0,0 +1,9 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 tidybyte
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
6
+
7
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
8
+
9
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,4 @@
1
+ include CHANGELOG.md
2
+ include llms.txt
3
+ include server.json
4
+ recursive-include tests *.py *.txt *.bin
@@ -0,0 +1,206 @@
1
+ Metadata-Version: 2.4
2
+ Name: tidy-hash-lite
3
+ Version: 1.0.1
4
+ Summary: Hash text or local files with SHA-256, SHA-1, MD5 and SHA-512. Hex and Base64. Local CLI and MCP server.
5
+ Author: Tidy Byte Tools
6
+ License-Expression: MIT
7
+ Project-URL: Homepage, https://github.com/tidybytetools/hash-lite
8
+ Project-URL: Documentation, https://github.com/tidybytetools/hash-lite#readme
9
+ Project-URL: Source, https://github.com/tidybytetools/hash-lite
10
+ Project-URL: Issues, https://github.com/tidybytetools/hash-lite/issues
11
+ Project-URL: Changelog, https://github.com/tidybytetools/hash-lite/blob/main/CHANGELOG.md
12
+ Project-URL: Apify, https://apify.com/tidybytetools/hash-checksum
13
+ Keywords: hash,checksum,sha256,sha1,md5,sha512,cli,mcp,mcp-server
14
+ Classifier: Development Status :: 4 - Beta
15
+ Classifier: Environment :: Console
16
+ Classifier: Intended Audience :: Developers
17
+ Classifier: Intended Audience :: End Users/Desktop
18
+ Classifier: Operating System :: OS Independent
19
+ Classifier: Programming Language :: Python :: 3
20
+ Classifier: Programming Language :: Python :: 3 :: Only
21
+ Classifier: Programming Language :: Python :: 3.10
22
+ Classifier: Programming Language :: Python :: 3.11
23
+ Classifier: Programming Language :: Python :: 3.12
24
+ Classifier: Programming Language :: Python :: 3.13
25
+ Classifier: Topic :: Utilities
26
+ Classifier: Topic :: Security :: Cryptography
27
+ Requires-Python: >=3.10
28
+ Description-Content-Type: text/markdown
29
+ License-File: LICENSE
30
+ Requires-Dist: mcp<2,>=1.10
31
+ Dynamic: license-file
32
+
33
+ <p>
34
+ <a href="https://github.com/tidybytetools">
35
+ <picture>
36
+ <source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/tidybytetools/hash-lite/main/assets/tidybytetools-lockup-dark.png">
37
+ <img alt="Tidy Byte Tools" src="https://raw.githubusercontent.com/tidybytetools/hash-lite/main/assets/tidybytetools-lockup-light.png" height="44">
38
+ </picture>
39
+ </a>
40
+ </p>
41
+
42
+ # hash-lite
43
+
44
+ [![License: MIT](https://img.shields.io/badge/license-MIT-green.svg)](https://github.com/tidybytetools/hash-lite/blob/main/LICENSE)
45
+ [![Python 3.10+](https://img.shields.io/badge/python-3.10%2B-blue.svg)](https://www.python.org/)
46
+ [![MCP server](https://img.shields.io/badge/MCP-stdio-purple.svg)](#use-it-from-claude-desktop-or-cursor-mcp)
47
+ [![Tests](https://github.com/tidybytetools/hash-lite/actions/workflows/tests.yml/badge.svg)](https://github.com/tidybytetools/hash-lite/actions/workflows/tests.yml)
48
+
49
+ Free tool that hashes text or local files with SHA-256, SHA-1, MD5, and optional SHA-512. You get hex and Base64.
50
+
51
+ Need it at scale in the cloud? A pay-per-use Apify Actor is in our publish queue and is **not public yet**. This free local tool is the one you can use today. We will add the Store link here after it goes live.
52
+
53
+ Plain code, not AI, so the same input always gives the same hashes. Runs on your own computer. MIT license. Works with Python 3.10 and newer, on Windows, Mac and Linux.
54
+
55
+ Also searched as: ES: hash SHA-256, suma de comprobación / PT: hash SHA-256 / DE: SHA-256 Hash, Prüfsumme / FR: hash SHA-256, somme de contrôle / JA: SHA-256、チェックサム
56
+
57
+ ## Links
58
+
59
+ - A pay-per-use Apify cloud version is in our publish queue and is **not public yet**. This free local tool is the one you can use today.
60
+
61
+ <!-- mcp-name: io.github.tidybytetools/hash-lite -->
62
+
63
+ ## Before and after
64
+
65
+ Before (text):
66
+
67
+ ```
68
+ hello world
69
+ ```
70
+
71
+ After (SHA-256, SHA-1, and MD5, which are on by default):
72
+
73
+ ```
74
+ sha256: b94d27b9934d3e08a52e52d7da7dabfac484efe37a5380ee9088f7ace2efcde9
75
+ sha1: 2aae6c35c94fcfb415dbe95f408b9ce91ee846ed
76
+ md5: 5eb63bbbe01eeed093cb22bb8f5acdc3
77
+ ```
78
+
79
+ Text is hashed as UTF-8 bytes. Local files are hashed as the raw file bytes.
80
+
81
+ ## Install
82
+
83
+ ```
84
+ pip install tidy-hash-lite
85
+ ```
86
+
87
+ Or use pipx, which keeps it in its own space:
88
+
89
+ ```
90
+ pipx install tidy-hash-lite
91
+ ```
92
+
93
+ The PyPI name is `tidy-hash-lite`. The command is still `hash-lite` (and `tidy-hash-lite` works too).
94
+
95
+ Or just download `hash_lite.py` and run it with `python3`. That one file uses only Python's standard library. (Installing with pip also adds the `mcp` package, which the MCP server needs.)
96
+
97
+ ## Use it
98
+
99
+ ```
100
+ printf 'hello world' | hash-lite
101
+ hash-lite photo.png
102
+ hash-lite photo.png --algorithms sha256,sha512
103
+ hash-lite photo.png --no-base64
104
+ printf 'hello world' | hash-lite --json # {"ok": true, "bytes": 11, "sha256": "...", ...}
105
+ ```
106
+
107
+ If you pass a file, the raw bytes are hashed. If you pipe text, it is hashed as UTF-8. `--algorithms` is a comma-separated list from `sha256`, `sha1`, `md5`, and `sha512`. The default is `sha256,sha1,md5`.
108
+
109
+ From Python:
110
+
111
+ ```python
112
+ from hash_lite import hash_text
113
+ hash_text("hello world")["sha256"] # 'b94d27b9934d3e08a52e52d7da7dabfac484efe37a5380ee9088f7ace2efcde9'
114
+ ```
115
+
116
+ When you run it in a terminal it prints one short line about the Apify version to stderr after the result. It never goes into your JSON output, it only shows when you are looking at a terminal, and `--quiet` turns it off.
117
+
118
+ ## Known limits
119
+
120
+ - **MD5 and SHA-1 are not safe for new security work.** They are included because people still need them for checks. Prefer SHA-256 or SHA-512 when you can.
121
+ - **Local files only.** This free tool does not fetch file links from the internet. The Apify version does.
122
+ - **5 MB cap in the MCP file tool.** The command line will read a larger local file, but very large jobs are a better fit for Apify.
123
+ - **It does not look the hash up** in a malware list or a password list.
124
+
125
+ ## Lite vs Apify
126
+
127
+ | | lite (free, this repo) | Apify cloud version (not public yet) |
128
+ |---|---|---|
129
+ | Hash text or files | yes, on your computer | yes, in the cloud |
130
+ | SHA-256, SHA-1, MD5, SHA-512 | yes | yes |
131
+ | Hex and Base64 | yes | yes |
132
+ | Fetch file links | no | yes |
133
+ | Many items in one run | you can loop on your own | yes, and repeats in the same run are free |
134
+ | MCP server for local AI apps | yes | use Apify MCP for the cloud tool |
135
+ | Price | free | $0.001 per unique input. All selected hashes are included |
136
+
137
+ ## Use it from Claude Desktop or Cursor (MCP)
138
+
139
+ There is a small free MCP server built in. It gives your AI app two tools. Both only read. They never write or change files, and they never use the internet. It needs [uv](https://docs.astral.sh/uv/).
140
+
141
+ Run it by hand to check it starts (it waits quietly for an app to talk to it):
142
+
143
+ ```
144
+ uvx --from tidy-hash-lite hash-lite mcp
145
+ ```
146
+
147
+ Claude Desktop (`claude_desktop_config.json`) or Cursor (`~/.cursor/mcp.json`):
148
+
149
+ ```json
150
+ {
151
+ "mcpServers": {
152
+ "hash-lite": {
153
+ "command": "uvx",
154
+ "args": ["--from", "tidy-hash-lite", "hash-lite", "mcp"]
155
+ }
156
+ }
157
+ }
158
+ ```
159
+
160
+ `uvx --from tidy-hash-lite hash-lite-mcp` starts the same server.
161
+
162
+ Tools:
163
+
164
+ - `hash_text(text, algorithms=null, include_base64=true)`: hash UTF-8 text in the chat.
165
+ - `hash_file(path, algorithms=null, include_base64=true)`: hash the raw bytes of a local file, up to 5 MB.
166
+
167
+ `algorithms` is a list from `sha256`, `sha1`, `md5`, `sha512`. The default is `sha256`, `sha1`, and `md5`. Both tools return the hex (and Base64, unless you turn that off) for each selected algorithm.
168
+
169
+ ## For AI agents
170
+
171
+ - **Use when:** you need a SHA-256, SHA-1, MD5 or SHA-512 checksum of text or a local file.
172
+ - **Don't use when:** you need to fetch a file from a URL, look a hash up in a malware list, or the file is bigger than 5 MB in MCP. Use the Apify version for URL and large-file jobs.
173
+ - **Input:** text on stdin (UTF-8) or a file path (raw bytes). Optional `--algorithms sha256,sha1,md5,sha512` and `--no-base64`.
174
+ - **MCP:** `uvx --from tidy-hash-lite hash-lite mcp` gives two read-only tools, `hash_text` and `hash_file`.
175
+ - **Output:** with `--json`, one object: `{"ok": true, "bytes": 11, "sha256": "...", ...}`. On error `ok` is false. Exit code 0 ok, 1 error.
176
+ - Hint lines go to stderr only, and only in a terminal, so stdout is always clean JSON. See also [`llms.txt`](https://github.com/tidybytetools/hash-lite/blob/main/llms.txt).
177
+
178
+ ## Tests
179
+
180
+ ```
181
+ pip install "mcp>=1.10,<2"
182
+ python3 -m unittest discover tests
183
+ ```
184
+
185
+ The MCP tests are skipped if `mcp` is not installed.
186
+
187
+ ## FAQ
188
+
189
+ **What input does it take?**
190
+ Text on stdin (hashed as UTF-8), or a local file (hashed as raw bytes).
191
+
192
+ **Do my files leave my computer?**
193
+ No. The tool runs on your computer and never uses the internet.
194
+
195
+ **Is MD5 or SHA-1 safe to use for security?**
196
+ No, not for new security work. Prefer SHA-256 or SHA-512. MD5 and SHA-1 are still useful for simple checks.
197
+
198
+ **How is this different from the Apify version?**
199
+ The Apify version runs in the cloud, can fetch file links, and can process many items in one run. This lite tool is free and local.
200
+
201
+ **Does it work with AI apps?**
202
+ Yes. It includes a free MCP server. No API key.
203
+
204
+ ## License
205
+
206
+ MIT. See `LICENSE`.
@@ -0,0 +1,174 @@
1
+ <p>
2
+ <a href="https://github.com/tidybytetools">
3
+ <picture>
4
+ <source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/tidybytetools/hash-lite/main/assets/tidybytetools-lockup-dark.png">
5
+ <img alt="Tidy Byte Tools" src="https://raw.githubusercontent.com/tidybytetools/hash-lite/main/assets/tidybytetools-lockup-light.png" height="44">
6
+ </picture>
7
+ </a>
8
+ </p>
9
+
10
+ # hash-lite
11
+
12
+ [![License: MIT](https://img.shields.io/badge/license-MIT-green.svg)](https://github.com/tidybytetools/hash-lite/blob/main/LICENSE)
13
+ [![Python 3.10+](https://img.shields.io/badge/python-3.10%2B-blue.svg)](https://www.python.org/)
14
+ [![MCP server](https://img.shields.io/badge/MCP-stdio-purple.svg)](#use-it-from-claude-desktop-or-cursor-mcp)
15
+ [![Tests](https://github.com/tidybytetools/hash-lite/actions/workflows/tests.yml/badge.svg)](https://github.com/tidybytetools/hash-lite/actions/workflows/tests.yml)
16
+
17
+ Free tool that hashes text or local files with SHA-256, SHA-1, MD5, and optional SHA-512. You get hex and Base64.
18
+
19
+ Need it at scale in the cloud? A pay-per-use Apify Actor is in our publish queue and is **not public yet**. This free local tool is the one you can use today. We will add the Store link here after it goes live.
20
+
21
+ Plain code, not AI, so the same input always gives the same hashes. Runs on your own computer. MIT license. Works with Python 3.10 and newer, on Windows, Mac and Linux.
22
+
23
+ Also searched as: ES: hash SHA-256, suma de comprobación / PT: hash SHA-256 / DE: SHA-256 Hash, Prüfsumme / FR: hash SHA-256, somme de contrôle / JA: SHA-256、チェックサム
24
+
25
+ ## Links
26
+
27
+ - A pay-per-use Apify cloud version is in our publish queue and is **not public yet**. This free local tool is the one you can use today.
28
+
29
+ <!-- mcp-name: io.github.tidybytetools/hash-lite -->
30
+
31
+ ## Before and after
32
+
33
+ Before (text):
34
+
35
+ ```
36
+ hello world
37
+ ```
38
+
39
+ After (SHA-256, SHA-1, and MD5, which are on by default):
40
+
41
+ ```
42
+ sha256: b94d27b9934d3e08a52e52d7da7dabfac484efe37a5380ee9088f7ace2efcde9
43
+ sha1: 2aae6c35c94fcfb415dbe95f408b9ce91ee846ed
44
+ md5: 5eb63bbbe01eeed093cb22bb8f5acdc3
45
+ ```
46
+
47
+ Text is hashed as UTF-8 bytes. Local files are hashed as the raw file bytes.
48
+
49
+ ## Install
50
+
51
+ ```
52
+ pip install tidy-hash-lite
53
+ ```
54
+
55
+ Or use pipx, which keeps it in its own space:
56
+
57
+ ```
58
+ pipx install tidy-hash-lite
59
+ ```
60
+
61
+ The PyPI name is `tidy-hash-lite`. The command is still `hash-lite` (and `tidy-hash-lite` works too).
62
+
63
+ Or just download `hash_lite.py` and run it with `python3`. That one file uses only Python's standard library. (Installing with pip also adds the `mcp` package, which the MCP server needs.)
64
+
65
+ ## Use it
66
+
67
+ ```
68
+ printf 'hello world' | hash-lite
69
+ hash-lite photo.png
70
+ hash-lite photo.png --algorithms sha256,sha512
71
+ hash-lite photo.png --no-base64
72
+ printf 'hello world' | hash-lite --json # {"ok": true, "bytes": 11, "sha256": "...", ...}
73
+ ```
74
+
75
+ If you pass a file, the raw bytes are hashed. If you pipe text, it is hashed as UTF-8. `--algorithms` is a comma-separated list from `sha256`, `sha1`, `md5`, and `sha512`. The default is `sha256,sha1,md5`.
76
+
77
+ From Python:
78
+
79
+ ```python
80
+ from hash_lite import hash_text
81
+ hash_text("hello world")["sha256"] # 'b94d27b9934d3e08a52e52d7da7dabfac484efe37a5380ee9088f7ace2efcde9'
82
+ ```
83
+
84
+ When you run it in a terminal it prints one short line about the Apify version to stderr after the result. It never goes into your JSON output, it only shows when you are looking at a terminal, and `--quiet` turns it off.
85
+
86
+ ## Known limits
87
+
88
+ - **MD5 and SHA-1 are not safe for new security work.** They are included because people still need them for checks. Prefer SHA-256 or SHA-512 when you can.
89
+ - **Local files only.** This free tool does not fetch file links from the internet. The Apify version does.
90
+ - **5 MB cap in the MCP file tool.** The command line will read a larger local file, but very large jobs are a better fit for Apify.
91
+ - **It does not look the hash up** in a malware list or a password list.
92
+
93
+ ## Lite vs Apify
94
+
95
+ | | lite (free, this repo) | Apify cloud version (not public yet) |
96
+ |---|---|---|
97
+ | Hash text or files | yes, on your computer | yes, in the cloud |
98
+ | SHA-256, SHA-1, MD5, SHA-512 | yes | yes |
99
+ | Hex and Base64 | yes | yes |
100
+ | Fetch file links | no | yes |
101
+ | Many items in one run | you can loop on your own | yes, and repeats in the same run are free |
102
+ | MCP server for local AI apps | yes | use Apify MCP for the cloud tool |
103
+ | Price | free | $0.001 per unique input. All selected hashes are included |
104
+
105
+ ## Use it from Claude Desktop or Cursor (MCP)
106
+
107
+ There is a small free MCP server built in. It gives your AI app two tools. Both only read. They never write or change files, and they never use the internet. It needs [uv](https://docs.astral.sh/uv/).
108
+
109
+ Run it by hand to check it starts (it waits quietly for an app to talk to it):
110
+
111
+ ```
112
+ uvx --from tidy-hash-lite hash-lite mcp
113
+ ```
114
+
115
+ Claude Desktop (`claude_desktop_config.json`) or Cursor (`~/.cursor/mcp.json`):
116
+
117
+ ```json
118
+ {
119
+ "mcpServers": {
120
+ "hash-lite": {
121
+ "command": "uvx",
122
+ "args": ["--from", "tidy-hash-lite", "hash-lite", "mcp"]
123
+ }
124
+ }
125
+ }
126
+ ```
127
+
128
+ `uvx --from tidy-hash-lite hash-lite-mcp` starts the same server.
129
+
130
+ Tools:
131
+
132
+ - `hash_text(text, algorithms=null, include_base64=true)`: hash UTF-8 text in the chat.
133
+ - `hash_file(path, algorithms=null, include_base64=true)`: hash the raw bytes of a local file, up to 5 MB.
134
+
135
+ `algorithms` is a list from `sha256`, `sha1`, `md5`, `sha512`. The default is `sha256`, `sha1`, and `md5`. Both tools return the hex (and Base64, unless you turn that off) for each selected algorithm.
136
+
137
+ ## For AI agents
138
+
139
+ - **Use when:** you need a SHA-256, SHA-1, MD5 or SHA-512 checksum of text or a local file.
140
+ - **Don't use when:** you need to fetch a file from a URL, look a hash up in a malware list, or the file is bigger than 5 MB in MCP. Use the Apify version for URL and large-file jobs.
141
+ - **Input:** text on stdin (UTF-8) or a file path (raw bytes). Optional `--algorithms sha256,sha1,md5,sha512` and `--no-base64`.
142
+ - **MCP:** `uvx --from tidy-hash-lite hash-lite mcp` gives two read-only tools, `hash_text` and `hash_file`.
143
+ - **Output:** with `--json`, one object: `{"ok": true, "bytes": 11, "sha256": "...", ...}`. On error `ok` is false. Exit code 0 ok, 1 error.
144
+ - Hint lines go to stderr only, and only in a terminal, so stdout is always clean JSON. See also [`llms.txt`](https://github.com/tidybytetools/hash-lite/blob/main/llms.txt).
145
+
146
+ ## Tests
147
+
148
+ ```
149
+ pip install "mcp>=1.10,<2"
150
+ python3 -m unittest discover tests
151
+ ```
152
+
153
+ The MCP tests are skipped if `mcp` is not installed.
154
+
155
+ ## FAQ
156
+
157
+ **What input does it take?**
158
+ Text on stdin (hashed as UTF-8), or a local file (hashed as raw bytes).
159
+
160
+ **Do my files leave my computer?**
161
+ No. The tool runs on your computer and never uses the internet.
162
+
163
+ **Is MD5 or SHA-1 safe to use for security?**
164
+ No, not for new security work. Prefer SHA-256 or SHA-512. MD5 and SHA-1 are still useful for simple checks.
165
+
166
+ **How is this different from the Apify version?**
167
+ The Apify version runs in the cloud, can fetch file links, and can process many items in one run. This lite tool is free and local.
168
+
169
+ **Does it work with AI apps?**
170
+ Yes. It includes a free MCP server. No API key.
171
+
172
+ ## License
173
+
174
+ MIT. See `LICENSE`.
@@ -0,0 +1,142 @@
1
+ #!/usr/bin/env python3
2
+ """hash-lite (MIT): hash text or local file bytes with SHA-256, SHA-1, MD5 and SHA-512.
3
+
4
+ This file uses only the Python standard library. The MCP server
5
+ (hash_lite_mcp.py) needs the mcp package.
6
+
7
+ Need it at scale or from an AI agent? Use the Apify version:
8
+ https://apify.com/tidybytetools/hash-checksum
9
+ """
10
+ from __future__ import annotations
11
+
12
+ import argparse
13
+ import base64
14
+ import hashlib
15
+ import json
16
+ import sys
17
+
18
+ __version__ = "1.0.1"
19
+ APIFY_URL = "https://apify.com/tidybytetools/hash-checksum"
20
+ PRO_LINE = f"Need it at scale or from an AI agent? Use the Apify version: {APIFY_URL}"
21
+
22
+ ALGOS = {
23
+ "md5": "md5",
24
+ "sha1": "sha1",
25
+ "sha256": "sha256",
26
+ "sha512": "sha512",
27
+ }
28
+ DEFAULT = ["sha256", "sha1", "md5"]
29
+ ALGO_HELP = "sha256, sha1, md5, sha512"
30
+
31
+
32
+ def parse_algorithms(value) -> list[str]:
33
+ if value is None:
34
+ return list(DEFAULT)
35
+ if isinstance(value, str):
36
+ parts = [p.strip().lower() for p in value.replace(";", ",").split(",") if p.strip()]
37
+ else:
38
+ parts = [str(p).strip().lower() for p in value if str(p).strip()]
39
+ if not parts:
40
+ raise ValueError("Pick at least one hash algorithm: " + ALGO_HELP)
41
+ unknown = [p for p in parts if p not in ALGOS]
42
+ if unknown:
43
+ raise ValueError(f"Unknown algorithm: {', '.join(unknown)}. Choose from {ALGO_HELP}.")
44
+ # keep order, drop repeats
45
+ seen = set()
46
+ out = []
47
+ for p in parts:
48
+ if p not in seen:
49
+ seen.add(p)
50
+ out.append(p)
51
+ return out
52
+
53
+
54
+ def hash_bytes(data: bytes, algorithms=None, include_base64: bool = True) -> dict:
55
+ if data is None:
56
+ raise ValueError("No data to hash.")
57
+ algos = parse_algorithms(algorithms)
58
+ out = {"bytes": len(data), "hashes": {}}
59
+ for name in algos:
60
+ digest = hashlib.new(ALGOS[name], data).digest()
61
+ rec = {"hex": digest.hex()}
62
+ if include_base64:
63
+ rec["base64"] = base64.b64encode(digest).decode("ascii")
64
+ out["hashes"][name] = rec
65
+ out[name] = rec["hex"]
66
+ if include_base64:
67
+ out[f"{name}Base64"] = rec["base64"]
68
+ return out
69
+
70
+
71
+ def hash_text(text: str, algorithms=None, include_base64: bool = True) -> dict:
72
+ if text is None or str(text) == "":
73
+ raise ValueError("The text is empty.")
74
+ data = str(text).encode("utf-8")
75
+ rec = hash_bytes(data, algorithms=algorithms, include_base64=include_base64)
76
+ rec["encoding"] = "utf-8"
77
+ rec["ok"] = True
78
+ return rec
79
+
80
+
81
+ def hash_file_bytes(data: bytes, algorithms=None, include_base64: bool = True) -> dict:
82
+ rec = hash_bytes(data, algorithms=algorithms, include_base64=include_base64)
83
+ rec["ok"] = True
84
+ return rec
85
+
86
+
87
+ def run_mcp():
88
+ """Start the stdio MCP server (needs the mcp package, which pip installs for you)."""
89
+ try:
90
+ import hash_lite_mcp
91
+ except ImportError as e:
92
+ print(f"error: the MCP server needs the mcp package ({e}). Run: pip install tidy-hash-lite", file=sys.stderr)
93
+ return 1
94
+ hash_lite_mcp.main()
95
+ return 0
96
+
97
+
98
+ def main(argv=None):
99
+ argv = sys.argv[1:] if argv is None else argv
100
+ if argv == ["mcp"]:
101
+ return run_mcp()
102
+ p = argparse.ArgumentParser(
103
+ prog="hash-lite",
104
+ description="Hash text or local file bytes with SHA-256, SHA-1, MD5 and SHA-512. Run `hash-lite mcp` to start the MCP server (to read a file named mcp, use ./mcp).",
105
+ epilog=PRO_LINE,
106
+ )
107
+ p.add_argument("file", nargs="?", help="file to hash as raw bytes (default: hash UTF-8 text from stdin)")
108
+ p.add_argument("--algorithms", "--algo", default=",".join(DEFAULT), help=f"comma-separated list from {ALGO_HELP} (default: {','.join(DEFAULT)})")
109
+ p.add_argument("--no-base64", action="store_true", help="do not include Base64 forms of each hash")
110
+ p.add_argument("--json", action="store_true", help="machine-readable envelope: {ok, bytes, hashes, ...}")
111
+ p.add_argument("--indent", type=int, default=2)
112
+ p.add_argument("-q", "--quiet", action="store_true", help="don't print the one-line note about the Apify version")
113
+ p.add_argument("--version", action="version", version=__version__)
114
+ a = p.parse_args(argv)
115
+ try:
116
+ if a.file:
117
+ with open(a.file, "rb") as f:
118
+ data = f.read()
119
+ rec = hash_file_bytes(data, algorithms=a.algorithms, include_base64=not a.no_base64)
120
+ else:
121
+ raw = sys.stdin.buffer.read()
122
+ if not raw:
123
+ raise ValueError("Nothing to hash. Pass a file or pipe text.")
124
+ rec = hash_text(raw.decode("utf-8"), algorithms=a.algorithms, include_base64=not a.no_base64)
125
+ pub = rec
126
+ if a.json:
127
+ print(json.dumps(pub, indent=a.indent, ensure_ascii=False))
128
+ else:
129
+ print(json.dumps(pub, indent=a.indent, ensure_ascii=False))
130
+ if not a.quiet and not a.json and sys.stderr.isatty():
131
+ print(PRO_LINE, file=sys.stderr)
132
+ return 0
133
+ except Exception as e:
134
+ if getattr(a, "json", False):
135
+ print(json.dumps({"ok": False, "error": str(e)}))
136
+ return 1
137
+ print(f"error: {e}", file=sys.stderr)
138
+ return 1
139
+
140
+
141
+ if __name__ == "__main__":
142
+ sys.exit(main())
@@ -0,0 +1,101 @@
1
+ """Free MCP server for hash-lite (stdio).
2
+
3
+ Run: uvx --from tidy-hash-lite hash-lite mcp
4
+ or: uvx --from tidy-hash-lite hash-lite-mcp
5
+ """
6
+ import os
7
+ from typing import Annotated, Literal
8
+ from pydantic import Field
9
+ from mcp.server.fastmcp import FastMCP
10
+ from mcp.types import ToolAnnotations
11
+ import hash_lite as lite
12
+
13
+ MAX_BYTES = 5_000_000 # 5 MB is plenty for local files
14
+
15
+ mcp = FastMCP("hash-lite")
16
+
17
+ READ_ONLY = dict(
18
+ readOnlyHint=True, # only reads; never writes or changes anything
19
+ destructiveHint=False,
20
+ idempotentHint=True, # same input always gives the same hashes
21
+ openWorldHint=False, # no network; works on the text or local file you give it
22
+ )
23
+
24
+ Algo = Literal["sha256", "sha1", "md5", "sha512"]
25
+ Algorithms = Annotated[
26
+ list[Algo] | None,
27
+ Field(description="Hash algorithms to compute. Default: sha256, sha1, md5. SHA-512 is optional. MD5 and SHA-1 are provided because people still need them for checks; they are not safe for new security work."),
28
+ ]
29
+
30
+
31
+ def _check_file(path: str) -> bytes:
32
+ path = os.path.expanduser(path)
33
+ if not os.path.isfile(path):
34
+ raise FileNotFoundError(f"file not found: {path}")
35
+ if os.path.getsize(path) > MAX_BYTES:
36
+ raise ValueError("file is bigger than 5 MB")
37
+ with open(path, "rb") as f:
38
+ return f.read()
39
+
40
+
41
+ @mcp.tool(
42
+ title="Hash a text string",
43
+ annotations=ToolAnnotations(title="Hash a text string", **READ_ONLY),
44
+ )
45
+ def hash_text(
46
+ text: Annotated[str, Field(description="The text to hash. It is hashed as UTF-8 bytes.")],
47
+ algorithms: Algorithms = None,
48
+ include_base64: Annotated[bool, Field(description="If true (default), each hash is returned as hex and as Base64. Hex is always included.")] = True,
49
+ ) -> dict:
50
+ """Hash pasted text with SHA-256, SHA-1, MD5, and optional SHA-512.
51
+
52
+ Use this when you have text in the conversation and need its checksum. The
53
+ text is hashed as UTF-8 bytes. It is plain code, not an AI model, so the same
54
+ text always gives the same hashes. This tool does not look the hash up in a
55
+ malware list or a password list. Do not use it for a file on disk (use
56
+ hash_file for files).
57
+
58
+ algorithms: a list from sha256, sha1, md5, sha512. Default is sha256, sha1
59
+ and md5. MD5 and SHA-1 are not safe for new security work; prefer SHA-256
60
+ or SHA-512 when you can.
61
+
62
+ Returns {"ok", "bytes", "encoding": "utf-8", "hashes", and a hex field for
63
+ each algorithm, plus a Base64 field when include_base64 is true}.
64
+ """
65
+ return lite.hash_text(text, algorithms=algorithms, include_base64=include_base64)
66
+
67
+
68
+ @mcp.tool(
69
+ title="Hash a local file",
70
+ annotations=ToolAnnotations(title="Hash a local file", **READ_ONLY),
71
+ )
72
+ def hash_file(
73
+ path: Annotated[str, Field(description="Full path to a local file, up to 5 MB. The raw file bytes are hashed, not a decoded string.")],
74
+ algorithms: Algorithms = None,
75
+ include_base64: Annotated[bool, Field(description="If true (default), each hash is returned as hex and as Base64. Hex is always included.")] = True,
76
+ ) -> dict:
77
+ """Hash a local file's raw bytes with SHA-256, SHA-1, MD5, and optional SHA-512.
78
+
79
+ Use this when the data is in a file on this computer, so you don't have to
80
+ paste it. The file is only read, never changed. Files larger than 5 MB are
81
+ rejected; use the Apify version for bigger jobs. This tool does not look the
82
+ hash up in a malware list or a password list.
83
+
84
+ path: full path to a file, up to 5 MB.
85
+ algorithms: a list from sha256, sha1, md5, sha512. Default is sha256, sha1
86
+ and md5. MD5 and SHA-1 are not safe for new security work; prefer SHA-256
87
+ or SHA-512 when you can.
88
+
89
+ Returns {"ok", "bytes", "hashes", and a hex field for each algorithm, plus a
90
+ Base64 field when include_base64 is true}.
91
+ """
92
+ data = _check_file(path)
93
+ return lite.hash_file_bytes(data, algorithms=algorithms, include_base64=include_base64)
94
+
95
+
96
+ def main():
97
+ mcp.run()
98
+
99
+
100
+ if __name__ == "__main__":
101
+ main()
@@ -0,0 +1,19 @@
1
+ # hash-lite
2
+
3
+ > Free, MIT-licensed, Python tool (the hasher is one standard-library file; the MCP server needs the mcp package) that hashes text (UTF-8) or local file bytes with SHA-256, SHA-1, MD5 and optional SHA-512. Hex is always returned; Base64 is included unless turned off.
4
+
5
+ - Install: `pip install tidy-hash-lite` (or download hash_lite.py)
6
+ - CLI: `hash-lite file` hashes raw file bytes. No file means stdin is hashed as UTF-8. `--algorithms sha256,sha1,md5,sha512` (default sha256,sha1,md5). `--no-base64`. `--json` prints `{"ok": true, "bytes": 11, "sha256": "..."}`. Exit 0 ok, 1 error.
7
+ - Python: `from hash_lite import hash_text; hash_text("hello world")`.
8
+ - MCP: `uvx --from tidy-hash-lite hash-lite mcp` exposes two read-only tools: `hash_text(text, algorithms=null, include_base64=true)` and `hash_file(path, ...)` for local files up to 5 MB.
9
+
10
+ ## Use when
11
+ - You need a SHA-256, SHA-1, MD5 or SHA-512 checksum of text or a local file.
12
+
13
+ ## Don't use when
14
+ - You need to fetch a file from a URL, look a hash up in a malware or password list, or the file is bigger than 5 MB in MCP. Use the Apify version: https://apify.com/tidybytetools/hash-checksum
15
+ - You need MD5 or SHA-1 for new security work. Prefer SHA-256 or SHA-512. MD5 and SHA-1 are only for simple checks.
16
+
17
+ ## Links
18
+ - [README](https://github.com/tidybytetools/hash-lite/blob/main/README.md)
19
+ - [Apify version](https://apify.com/tidybytetools/hash-checksum)
@@ -0,0 +1,48 @@
1
+ [build-system]
2
+ requires = ["setuptools>=77"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "tidy-hash-lite"
7
+ version = "1.0.1"
8
+ description = "Hash text or local files with SHA-256, SHA-1, MD5 and SHA-512. Hex and Base64. Local CLI and MCP server."
9
+ readme = "README.md"
10
+ license = "MIT"
11
+ license-files = ["LICENSE"]
12
+ authors = [{name = "Tidy Byte Tools"}]
13
+ requires-python = ">=3.10"
14
+ dependencies = [
15
+ "mcp>=1.10,<2",
16
+ ]
17
+ keywords = ["hash", "checksum", "sha256", "sha1", "md5", "sha512", "cli", "mcp", "mcp-server"]
18
+ classifiers = [
19
+ "Development Status :: 4 - Beta",
20
+ "Environment :: Console",
21
+ "Intended Audience :: Developers",
22
+ "Intended Audience :: End Users/Desktop",
23
+ "Operating System :: OS Independent",
24
+ "Programming Language :: Python :: 3",
25
+ "Programming Language :: Python :: 3 :: Only",
26
+ "Programming Language :: Python :: 3.10",
27
+ "Programming Language :: Python :: 3.11",
28
+ "Programming Language :: Python :: 3.12",
29
+ "Programming Language :: Python :: 3.13",
30
+ "Topic :: Utilities",
31
+ "Topic :: Security :: Cryptography",
32
+ ]
33
+
34
+ [project.urls]
35
+ Homepage = "https://github.com/tidybytetools/hash-lite"
36
+ Documentation = "https://github.com/tidybytetools/hash-lite#readme"
37
+ Source = "https://github.com/tidybytetools/hash-lite"
38
+ Issues = "https://github.com/tidybytetools/hash-lite/issues"
39
+ Changelog = "https://github.com/tidybytetools/hash-lite/blob/main/CHANGELOG.md"
40
+ Apify = "https://apify.com/tidybytetools/hash-checksum"
41
+
42
+ [project.scripts]
43
+ hash-lite = "hash_lite:main"
44
+ tidy-hash-lite = "hash_lite:main"
45
+ hash-lite-mcp = "hash_lite_mcp:main"
46
+
47
+ [tool.setuptools]
48
+ py-modules = ["hash_lite", "hash_lite_mcp"]
@@ -0,0 +1,31 @@
1
+ {
2
+ "$schema": "https://static.modelcontextprotocol.io/schemas/2025-12-11/server.schema.json",
3
+ "name": "io.github.tidybytetools/hash-lite",
4
+ "title": "hash-lite",
5
+ "description": "Hash text or files with SHA-256, SHA-1, MD5 and SHA-512, as hex or Base64. CLI and MCP server.",
6
+ "repository": {
7
+ "url": "https://github.com/tidybytetools/hash-lite",
8
+ "source": "github"
9
+ },
10
+ "websiteUrl": "https://github.com/tidybytetools/hash-lite",
11
+ "version": "1.0.1",
12
+ "packages": [
13
+ {
14
+ "registryType": "pypi",
15
+ "registryBaseUrl": "https://pypi.org",
16
+ "identifier": "tidy-hash-lite",
17
+ "version": "1.0.1",
18
+ "runtimeHint": "uvx",
19
+ "transport": {
20
+ "type": "stdio"
21
+ },
22
+ "packageArguments": [
23
+ {
24
+ "type": "positional",
25
+ "value": "mcp",
26
+ "description": "Starts the MCP server instead of the command-line tool."
27
+ }
28
+ ]
29
+ }
30
+ ]
31
+ }
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1 @@
1
+ abc
@@ -0,0 +1 @@
1
+ hello world
@@ -0,0 +1,93 @@
1
+ import io, os, sys, tempfile, unittest
2
+ from contextlib import redirect_stdout, redirect_stderr
3
+ sys.path.insert(0, os.path.join(os.path.dirname(__file__), ".."))
4
+ import hash_lite as hl
5
+
6
+ class T(unittest.TestCase):
7
+ def test_hello_sha256(self):
8
+ r = hl.hash_text("hello world")
9
+ self.assertEqual(r["bytes"], 11)
10
+ self.assertEqual(r["sha256"], "b94d27b9934d3e08a52e52d7da7dabfac484efe37a5380ee9088f7ace2efcde9")
11
+ self.assertEqual(r["sha1"], "2aae6c35c94fcfb415dbe95f408b9ce91ee846ed")
12
+ self.assertEqual(r["md5"], "5eb63bbbe01eeed093cb22bb8f5acdc3")
13
+ self.assertTrue(r["sha256Base64"])
14
+ self.assertEqual(r["encoding"], "utf-8")
15
+ self.assertTrue(r["ok"])
16
+
17
+ def test_empty_text(self):
18
+ with self.assertRaises(ValueError):
19
+ hl.hash_text("")
20
+
21
+ def test_file_bytes_and_sha512(self):
22
+ r = hl.hash_bytes(b"abc", algorithms=["sha256", "sha512"], include_base64=False)
23
+ self.assertIn("sha512", r["hashes"])
24
+ self.assertNotIn("sha512Base64", r)
25
+ self.assertEqual(r["sha256"], "ba7816bf8f01cfea414140de5dae2223b00361a396177a9cb410ff61f20015ad")
26
+
27
+ def test_bad_algo(self):
28
+ with self.assertRaises(ValueError):
29
+ hl.hash_bytes(b"x", algorithms=["blake3"])
30
+
31
+ def test_parse_algorithms_default_and_dedupe(self):
32
+ self.assertEqual(hl.parse_algorithms(None), ["sha256", "sha1", "md5"])
33
+ self.assertEqual(hl.parse_algorithms("SHA256, sha256, md5"), ["sha256", "md5"])
34
+
35
+ def test_parse_algorithms_empty(self):
36
+ with self.assertRaises(ValueError):
37
+ hl.parse_algorithms("")
38
+
39
+ def run_main(self, argv, stdin_text=""):
40
+ out, err = io.StringIO(), io.StringIO()
41
+ old = sys.stdin
42
+ raw = stdin_text.encode("utf-8")
43
+ sys.stdin = io.TextIOWrapper(io.BytesIO(raw), encoding="utf-8")
44
+ try:
45
+ with redirect_stdout(out), redirect_stderr(err):
46
+ code = hl.main(argv)
47
+ finally:
48
+ sys.stdin = old
49
+ return code, out.getvalue(), err.getvalue()
50
+
51
+ def test_cli_json_text(self):
52
+ code, out, err = self.run_main(["--json"], "hello world")
53
+ self.assertEqual(code, 0)
54
+ self.assertIn('"ok": true', out)
55
+ self.assertIn("b94d27b9934d3e08a52e52d7da7dabfac484efe37a5380ee9088f7ace2efcde9", out)
56
+ self.assertNotIn("apify.com", out)
57
+
58
+ def test_cli_file_bytes(self):
59
+ with tempfile.TemporaryDirectory() as td:
60
+ path = os.path.join(td, "abc.bin")
61
+ with open(path, "wb") as f:
62
+ f.write(b"abc")
63
+ code, out, err = self.run_main(["--json", "--algorithms", "sha256", "--no-base64", path])
64
+ self.assertEqual(code, 0)
65
+ self.assertIn("ba7816bf8f01cfea414140de5dae2223b00361a396177a9cb410ff61f20015ad", out)
66
+ self.assertNotIn("Base64", out)
67
+
68
+ def test_cli_help_has_apify_link(self):
69
+ out = io.StringIO()
70
+ with redirect_stdout(out), self.assertRaises(SystemExit):
71
+ hl.main(["--help"])
72
+ self.assertIn("https://apify.com/tidybytetools/hash-checksum", out.getvalue())
73
+
74
+ def test_bad_file(self):
75
+ code, out, err = self.run_main(["--json", "/nope/missing.bin"])
76
+ self.assertEqual(code, 1)
77
+ self.assertIn('"ok": false', out)
78
+
79
+ def test_empty_stdin_json(self):
80
+ code, out, err = self.run_main(["--json"], "")
81
+ self.assertEqual(code, 1)
82
+ self.assertIn('"ok": false', out)
83
+
84
+ def test_version(self):
85
+ out = io.StringIO()
86
+ with redirect_stdout(out), self.assertRaises(SystemExit) as ctx:
87
+ hl.main(["--version"])
88
+ self.assertIn(ctx.exception.code, (0, None))
89
+ self.assertIn("1.0.1", out.getvalue())
90
+
91
+
92
+ if __name__ == "__main__":
93
+ unittest.main()
@@ -0,0 +1,71 @@
1
+ """Starts the MCP server over stdio (both ways it can start), lists tools, and calls them."""
2
+ import asyncio, json, os, sys, unittest
3
+ HERE = os.path.dirname(os.path.abspath(__file__))
4
+ ROOT = os.path.dirname(HERE)
5
+
6
+ try:
7
+ from mcp import ClientSession, StdioServerParameters
8
+ from mcp.client.stdio import stdio_client
9
+ except ImportError:
10
+ ClientSession = None
11
+
12
+ READ_ONLY = {"readOnlyHint": True, "destructiveHint": False, "idempotentHint": True, "openWorldHint": False}
13
+
14
+
15
+ def _data(res):
16
+ """The tool result as Python data (structured content if present, else the JSON text)."""
17
+ if res.structuredContent is not None:
18
+ sc = res.structuredContent
19
+ return sc.get("result", sc) if set(sc) == {"result"} else sc
20
+ return json.loads(res.content[0].text)
21
+
22
+
23
+ async def _session(args, fn):
24
+ params = StdioServerParameters(command=sys.executable, args=args, cwd=ROOT)
25
+ async with stdio_client(params) as (r, w):
26
+ async with ClientSession(r, w) as s:
27
+ await s.initialize()
28
+ return await fn(s)
29
+
30
+
31
+ @unittest.skipIf(ClientSession is None, "mcp not installed")
32
+ class MCP(unittest.TestCase):
33
+ def test_tools_and_annotations(self):
34
+ async def go(s):
35
+ return (await s.list_tools()).tools
36
+ tools = asyncio.run(_session([os.path.join(ROOT, "hash_lite_mcp.py")], go))
37
+ self.assertEqual(sorted(t.name for t in tools), ["hash_file", "hash_text"])
38
+ for t in tools:
39
+ self.assertTrue(t.title)
40
+ self.assertIn("Use this when", t.description)
41
+ for k, v in READ_ONLY.items():
42
+ self.assertIs(getattr(t.annotations, k), v, f"{t.name} {k}")
43
+
44
+ def test_calls(self):
45
+ async def go(s):
46
+ hello = await s.call_tool("hash_text", {"text": "hello world"})
47
+ sha_only = await s.call_tool("hash_text", {"text": "hello world", "algorithms": ["sha256"], "include_base64": False})
48
+ f = await s.call_tool("hash_file", {"path": os.path.join(HERE, "fixtures", "abc.bin"), "algorithms": ["sha256"], "include_base64": False})
49
+ missing = await s.call_tool("hash_file", {"path": "/nope/missing.bin"})
50
+ empty = await s.call_tool("hash_text", {"text": ""})
51
+ bad = await s.call_tool("hash_text", {"text": "x", "algorithms": ["blake3"]})
52
+ return hello, sha_only, f, missing, empty, bad
53
+ hello, sha_only, f, missing, empty, bad = asyncio.run(_session([os.path.join(ROOT, "hash_lite_mcp.py")], go))
54
+ self.assertEqual(_data(hello)["sha256"], "b94d27b9934d3e08a52e52d7da7dabfac484efe37a5380ee9088f7ace2efcde9")
55
+ self.assertIn("sha256Base64", _data(hello))
56
+ self.assertEqual(_data(sha_only)["sha256"], "b94d27b9934d3e08a52e52d7da7dabfac484efe37a5380ee9088f7ace2efcde9")
57
+ self.assertNotIn("sha256Base64", _data(sha_only))
58
+ self.assertEqual(_data(f)["sha256"], "ba7816bf8f01cfea414140de5dae2223b00361a396177a9cb410ff61f20015ad")
59
+ self.assertTrue(missing.isError)
60
+ self.assertTrue(empty.isError)
61
+ self.assertTrue(bad.isError)
62
+
63
+ def test_cli_mcp_subcommand_starts_server(self):
64
+ async def go(s):
65
+ return [t.name for t in (await s.list_tools()).tools]
66
+ names = asyncio.run(_session([os.path.join(ROOT, "hash_lite.py"), "mcp"], go))
67
+ self.assertIn("hash_text", names)
68
+
69
+
70
+ if __name__ == "__main__":
71
+ unittest.main()
@@ -0,0 +1,206 @@
1
+ Metadata-Version: 2.4
2
+ Name: tidy-hash-lite
3
+ Version: 1.0.1
4
+ Summary: Hash text or local files with SHA-256, SHA-1, MD5 and SHA-512. Hex and Base64. Local CLI and MCP server.
5
+ Author: Tidy Byte Tools
6
+ License-Expression: MIT
7
+ Project-URL: Homepage, https://github.com/tidybytetools/hash-lite
8
+ Project-URL: Documentation, https://github.com/tidybytetools/hash-lite#readme
9
+ Project-URL: Source, https://github.com/tidybytetools/hash-lite
10
+ Project-URL: Issues, https://github.com/tidybytetools/hash-lite/issues
11
+ Project-URL: Changelog, https://github.com/tidybytetools/hash-lite/blob/main/CHANGELOG.md
12
+ Project-URL: Apify, https://apify.com/tidybytetools/hash-checksum
13
+ Keywords: hash,checksum,sha256,sha1,md5,sha512,cli,mcp,mcp-server
14
+ Classifier: Development Status :: 4 - Beta
15
+ Classifier: Environment :: Console
16
+ Classifier: Intended Audience :: Developers
17
+ Classifier: Intended Audience :: End Users/Desktop
18
+ Classifier: Operating System :: OS Independent
19
+ Classifier: Programming Language :: Python :: 3
20
+ Classifier: Programming Language :: Python :: 3 :: Only
21
+ Classifier: Programming Language :: Python :: 3.10
22
+ Classifier: Programming Language :: Python :: 3.11
23
+ Classifier: Programming Language :: Python :: 3.12
24
+ Classifier: Programming Language :: Python :: 3.13
25
+ Classifier: Topic :: Utilities
26
+ Classifier: Topic :: Security :: Cryptography
27
+ Requires-Python: >=3.10
28
+ Description-Content-Type: text/markdown
29
+ License-File: LICENSE
30
+ Requires-Dist: mcp<2,>=1.10
31
+ Dynamic: license-file
32
+
33
+ <p>
34
+ <a href="https://github.com/tidybytetools">
35
+ <picture>
36
+ <source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/tidybytetools/hash-lite/main/assets/tidybytetools-lockup-dark.png">
37
+ <img alt="Tidy Byte Tools" src="https://raw.githubusercontent.com/tidybytetools/hash-lite/main/assets/tidybytetools-lockup-light.png" height="44">
38
+ </picture>
39
+ </a>
40
+ </p>
41
+
42
+ # hash-lite
43
+
44
+ [![License: MIT](https://img.shields.io/badge/license-MIT-green.svg)](https://github.com/tidybytetools/hash-lite/blob/main/LICENSE)
45
+ [![Python 3.10+](https://img.shields.io/badge/python-3.10%2B-blue.svg)](https://www.python.org/)
46
+ [![MCP server](https://img.shields.io/badge/MCP-stdio-purple.svg)](#use-it-from-claude-desktop-or-cursor-mcp)
47
+ [![Tests](https://github.com/tidybytetools/hash-lite/actions/workflows/tests.yml/badge.svg)](https://github.com/tidybytetools/hash-lite/actions/workflows/tests.yml)
48
+
49
+ Free tool that hashes text or local files with SHA-256, SHA-1, MD5, and optional SHA-512. You get hex and Base64.
50
+
51
+ Need it at scale in the cloud? A pay-per-use Apify Actor is in our publish queue and is **not public yet**. This free local tool is the one you can use today. We will add the Store link here after it goes live.
52
+
53
+ Plain code, not AI, so the same input always gives the same hashes. Runs on your own computer. MIT license. Works with Python 3.10 and newer, on Windows, Mac and Linux.
54
+
55
+ Also searched as: ES: hash SHA-256, suma de comprobación / PT: hash SHA-256 / DE: SHA-256 Hash, Prüfsumme / FR: hash SHA-256, somme de contrôle / JA: SHA-256、チェックサム
56
+
57
+ ## Links
58
+
59
+ - A pay-per-use Apify cloud version is in our publish queue and is **not public yet**. This free local tool is the one you can use today.
60
+
61
+ <!-- mcp-name: io.github.tidybytetools/hash-lite -->
62
+
63
+ ## Before and after
64
+
65
+ Before (text):
66
+
67
+ ```
68
+ hello world
69
+ ```
70
+
71
+ After (SHA-256, SHA-1, and MD5, which are on by default):
72
+
73
+ ```
74
+ sha256: b94d27b9934d3e08a52e52d7da7dabfac484efe37a5380ee9088f7ace2efcde9
75
+ sha1: 2aae6c35c94fcfb415dbe95f408b9ce91ee846ed
76
+ md5: 5eb63bbbe01eeed093cb22bb8f5acdc3
77
+ ```
78
+
79
+ Text is hashed as UTF-8 bytes. Local files are hashed as the raw file bytes.
80
+
81
+ ## Install
82
+
83
+ ```
84
+ pip install tidy-hash-lite
85
+ ```
86
+
87
+ Or use pipx, which keeps it in its own space:
88
+
89
+ ```
90
+ pipx install tidy-hash-lite
91
+ ```
92
+
93
+ The PyPI name is `tidy-hash-lite`. The command is still `hash-lite` (and `tidy-hash-lite` works too).
94
+
95
+ Or just download `hash_lite.py` and run it with `python3`. That one file uses only Python's standard library. (Installing with pip also adds the `mcp` package, which the MCP server needs.)
96
+
97
+ ## Use it
98
+
99
+ ```
100
+ printf 'hello world' | hash-lite
101
+ hash-lite photo.png
102
+ hash-lite photo.png --algorithms sha256,sha512
103
+ hash-lite photo.png --no-base64
104
+ printf 'hello world' | hash-lite --json # {"ok": true, "bytes": 11, "sha256": "...", ...}
105
+ ```
106
+
107
+ If you pass a file, the raw bytes are hashed. If you pipe text, it is hashed as UTF-8. `--algorithms` is a comma-separated list from `sha256`, `sha1`, `md5`, and `sha512`. The default is `sha256,sha1,md5`.
108
+
109
+ From Python:
110
+
111
+ ```python
112
+ from hash_lite import hash_text
113
+ hash_text("hello world")["sha256"] # 'b94d27b9934d3e08a52e52d7da7dabfac484efe37a5380ee9088f7ace2efcde9'
114
+ ```
115
+
116
+ When you run it in a terminal it prints one short line about the Apify version to stderr after the result. It never goes into your JSON output, it only shows when you are looking at a terminal, and `--quiet` turns it off.
117
+
118
+ ## Known limits
119
+
120
+ - **MD5 and SHA-1 are not safe for new security work.** They are included because people still need them for checks. Prefer SHA-256 or SHA-512 when you can.
121
+ - **Local files only.** This free tool does not fetch file links from the internet. The Apify version does.
122
+ - **5 MB cap in the MCP file tool.** The command line will read a larger local file, but very large jobs are a better fit for Apify.
123
+ - **It does not look the hash up** in a malware list or a password list.
124
+
125
+ ## Lite vs Apify
126
+
127
+ | | lite (free, this repo) | Apify cloud version (not public yet) |
128
+ |---|---|---|
129
+ | Hash text or files | yes, on your computer | yes, in the cloud |
130
+ | SHA-256, SHA-1, MD5, SHA-512 | yes | yes |
131
+ | Hex and Base64 | yes | yes |
132
+ | Fetch file links | no | yes |
133
+ | Many items in one run | you can loop on your own | yes, and repeats in the same run are free |
134
+ | MCP server for local AI apps | yes | use Apify MCP for the cloud tool |
135
+ | Price | free | $0.001 per unique input. All selected hashes are included |
136
+
137
+ ## Use it from Claude Desktop or Cursor (MCP)
138
+
139
+ There is a small free MCP server built in. It gives your AI app two tools. Both only read. They never write or change files, and they never use the internet. It needs [uv](https://docs.astral.sh/uv/).
140
+
141
+ Run it by hand to check it starts (it waits quietly for an app to talk to it):
142
+
143
+ ```
144
+ uvx --from tidy-hash-lite hash-lite mcp
145
+ ```
146
+
147
+ Claude Desktop (`claude_desktop_config.json`) or Cursor (`~/.cursor/mcp.json`):
148
+
149
+ ```json
150
+ {
151
+ "mcpServers": {
152
+ "hash-lite": {
153
+ "command": "uvx",
154
+ "args": ["--from", "tidy-hash-lite", "hash-lite", "mcp"]
155
+ }
156
+ }
157
+ }
158
+ ```
159
+
160
+ `uvx --from tidy-hash-lite hash-lite-mcp` starts the same server.
161
+
162
+ Tools:
163
+
164
+ - `hash_text(text, algorithms=null, include_base64=true)`: hash UTF-8 text in the chat.
165
+ - `hash_file(path, algorithms=null, include_base64=true)`: hash the raw bytes of a local file, up to 5 MB.
166
+
167
+ `algorithms` is a list from `sha256`, `sha1`, `md5`, `sha512`. The default is `sha256`, `sha1`, and `md5`. Both tools return the hex (and Base64, unless you turn that off) for each selected algorithm.
168
+
169
+ ## For AI agents
170
+
171
+ - **Use when:** you need a SHA-256, SHA-1, MD5 or SHA-512 checksum of text or a local file.
172
+ - **Don't use when:** you need to fetch a file from a URL, look a hash up in a malware list, or the file is bigger than 5 MB in MCP. Use the Apify version for URL and large-file jobs.
173
+ - **Input:** text on stdin (UTF-8) or a file path (raw bytes). Optional `--algorithms sha256,sha1,md5,sha512` and `--no-base64`.
174
+ - **MCP:** `uvx --from tidy-hash-lite hash-lite mcp` gives two read-only tools, `hash_text` and `hash_file`.
175
+ - **Output:** with `--json`, one object: `{"ok": true, "bytes": 11, "sha256": "...", ...}`. On error `ok` is false. Exit code 0 ok, 1 error.
176
+ - Hint lines go to stderr only, and only in a terminal, so stdout is always clean JSON. See also [`llms.txt`](https://github.com/tidybytetools/hash-lite/blob/main/llms.txt).
177
+
178
+ ## Tests
179
+
180
+ ```
181
+ pip install "mcp>=1.10,<2"
182
+ python3 -m unittest discover tests
183
+ ```
184
+
185
+ The MCP tests are skipped if `mcp` is not installed.
186
+
187
+ ## FAQ
188
+
189
+ **What input does it take?**
190
+ Text on stdin (hashed as UTF-8), or a local file (hashed as raw bytes).
191
+
192
+ **Do my files leave my computer?**
193
+ No. The tool runs on your computer and never uses the internet.
194
+
195
+ **Is MD5 or SHA-1 safe to use for security?**
196
+ No, not for new security work. Prefer SHA-256 or SHA-512. MD5 and SHA-1 are still useful for simple checks.
197
+
198
+ **How is this different from the Apify version?**
199
+ The Apify version runs in the cloud, can fetch file links, and can process many items in one run. This lite tool is free and local.
200
+
201
+ **Does it work with AI apps?**
202
+ Yes. It includes a free MCP server. No API key.
203
+
204
+ ## License
205
+
206
+ MIT. See `LICENSE`.
@@ -0,0 +1,19 @@
1
+ CHANGELOG.md
2
+ LICENSE
3
+ MANIFEST.in
4
+ README.md
5
+ hash_lite.py
6
+ hash_lite_mcp.py
7
+ llms.txt
8
+ pyproject.toml
9
+ server.json
10
+ tests/test_lite.py
11
+ tests/test_mcp.py
12
+ tests/fixtures/abc.bin
13
+ tests/fixtures/hello.txt
14
+ tidy_hash_lite.egg-info/PKG-INFO
15
+ tidy_hash_lite.egg-info/SOURCES.txt
16
+ tidy_hash_lite.egg-info/dependency_links.txt
17
+ tidy_hash_lite.egg-info/entry_points.txt
18
+ tidy_hash_lite.egg-info/requires.txt
19
+ tidy_hash_lite.egg-info/top_level.txt
@@ -0,0 +1,4 @@
1
+ [console_scripts]
2
+ hash-lite = hash_lite:main
3
+ hash-lite-mcp = hash_lite_mcp:main
4
+ tidy-hash-lite = hash_lite:main
@@ -0,0 +1 @@
1
+ mcp<2,>=1.10
@@ -0,0 +1,2 @@
1
+ hash_lite
2
+ hash_lite_mcp