mshesh 0.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.
mshesh-0.1.0.1/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 tderk
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,9 @@
1
+ include LICENSE
2
+ include README.md
3
+ include pyproject.toml
4
+ recursive-include src/mshesh *.py py.typed
5
+ recursive-include src/mshesh/data *.txt
6
+ recursive-include tests *.py
7
+ global-exclude __pycache__
8
+ global-exclude *.pyc
9
+ global-exclude *.pyo
@@ -0,0 +1,187 @@
1
+ Metadata-Version: 2.4
2
+ Name: mshesh
3
+ Version: 0.1.0.1
4
+ Summary: mshesh // a tiny hash terminal with random hashes, value hashes, and a jittered monitor
5
+ Author: tderk
6
+ License-Expression: MIT
7
+ Keywords: hash,sha256,terminal,monitor,logging,cli
8
+ Classifier: Environment :: Console
9
+ Classifier: Intended Audience :: End Users/Desktop
10
+ Classifier: Programming Language :: Python :: 3
11
+ Classifier: Topic :: Security :: Cryptography
12
+ Classifier: Topic :: Terminals
13
+ Classifier: Topic :: Utilities
14
+ Requires-Python: >=3.8
15
+ Description-Content-Type: text/markdown
16
+ License-File: LICENSE
17
+ Provides-Extra: dev
18
+ Requires-Dist: build; extra == "dev"
19
+ Requires-Dist: twine; extra == "dev"
20
+ Requires-Dist: pytest>=7; extra == "dev"
21
+ Dynamic: license-file
22
+
23
+ # mshesh
24
+
25
+ `mshesh` is a small terminal hash app. It asks for a username, then drops you
26
+ into a hash terminal:
27
+
28
+ - press **Enter on an empty line** → a fresh random hash;
29
+ - type **any text** → the SHA-256 hash of exactly that text;
30
+ - run **monitor mode** → hashes appear at randomized intervals;
31
+ - **record** every hash live, **save the whole log**, or **save only the last
32
+ N lines**;
33
+ - **translate** any hash into 24 BIP39 words with `/words`.
34
+
35
+ Hashes are 64 lowercase hex characters (SHA-256 output for value hashes and a
36
+ 32-byte `secrets` token for random hashes).
37
+
38
+ ## Install
39
+
40
+ From this folder:
41
+
42
+ ```bash
43
+ python3 -m pip install .
44
+ ```
45
+
46
+ For development:
47
+
48
+ ```bash
49
+ python3 -m pip install -e ".[dev]"
50
+ ```
51
+
52
+ This installs the `mshesh` command. You can also run it without installing:
53
+
54
+ ```bash
55
+ PYTHONPATH=src python3 -m mshesh
56
+ ```
57
+
58
+ ## Usage
59
+
60
+ ```bash
61
+ mshesh
62
+ ```
63
+
64
+ ```text
65
+ username: kredt
66
+ mshesh 0.1.0.1 | hash terminal
67
+ user: kredt | log: /home/kredt/mshesh-log.txt
68
+ Enter = random hash | text = hash of text | /help for commands
69
+ kredt@mshesh>
70
+ 9f86d081884c7d659a2feaa0c55ad015a3bf4f1b2b0b822cd15d6c15b0f00a08 sha256 [random]
71
+ kredt@mshesh> hello
72
+ 2cf24dba5fb0a30e26e83b2ac5b9e29e1b161e5c1fa7425e73043362938b9824 sha256 [value=hello]
73
+ ```
74
+
75
+ Use `//text` when you want to hash text that itself begins with a slash.
76
+
77
+ Print several random lines at once (all random, all logged):
78
+
79
+ ```text
80
+ kredt@mshesh> /random 3
81
+ 9f86d081884c7d659a2feaa0c55ad015a3bf4f1b2b0b822cd15d6c15b0f00a08 sha256 [random]
82
+ ...
83
+ ```
84
+
85
+ ### Commands
86
+
87
+ | Command | What it does |
88
+ | --- | --- |
89
+ | `/monitor [i] [chance] [n]` | Monitor mode. `i` is the standard interval in seconds, `chance` is an integer 0–100, `n` is an optional tick limit. `Ctrl+C` stops. |
90
+ | `/random N` | Print `N` random hash lines. They are also added to the log and any active recording. |
91
+ | `/words [N]` | Encode the latest hash, or the last `N` hashes, as 24 BIP39 words each. |
92
+ | `/record [path]` | Start (or keep) live recording of every new hash to a text file. Default: `./mshesh-record.txt`. |
93
+ | `/record off` | Stop live recording. |
94
+ | `/save [path]` | Save the whole in-memory log. Default: `./mshesh-log.txt`. |
95
+ | `/save-lines N [path]` | Save only the last `N` lines of the log. |
96
+ | `/log [N]` | Show the whole log or only its last `N` lines. |
97
+ | `/user [name]` | Show or change the username. |
98
+ | `/status` | Show user, hash count, log path, and recording path. |
99
+ | `/clear` | Clear the terminal and redraw the banner. |
100
+ | `/help` | Show command help. |
101
+ | `/quit` | Leave the terminal (`Ctrl+D` also works). |
102
+
103
+ Log and recording lines are pipe-delimited:
104
+
105
+ ```text
106
+ 2026-11-25T03:04:05 | kredt | value=hello | 2cf24dba5fb0a30e26e83b2ac5b9e29e1b161e5c1fa7425e73043362938b9824
107
+ 2026-11-25T03:04:09 | kredt | random | 9f86d081884c7d659a2feaa0c55ad015a3bf4f1b2b0b822cd15d6c15b0f00a08
108
+ ```
109
+
110
+ ## Monitor mode
111
+
112
+ ```bash
113
+ mshesh --monitor --interval 5 --value-chance 60
114
+ ```
115
+
116
+ or from inside the terminal:
117
+
118
+ ```text
119
+ kredt@mshesh> /monitor 5 60
120
+ monitor: every ~5s | value chance 60% | Ctrl+C to stop
121
+ ```
122
+
123
+ The **standard monitoring time** is `5.0` seconds. Each delay is jittered
124
+ between 60% and 140% of that value, so the monitor never beats at a perfectly
125
+ fixed rate.
126
+
127
+ The integer `value_chance` (0–100) decides, per tick, whether that particular
128
+ instance supplies a value:
129
+
130
+ - **value supplied** → hash of a word from the built-in value pool, plus an
131
+ extra randomized half-interval delay (more time randomization);
132
+ - **no value** → a random hash.
133
+
134
+ `0` means "always random"; `100` means "always hash a supplied value".
135
+ `/monitor 5 60 10` runs ten ticks and stops by itself.
136
+
137
+ ## Word encoding
138
+
139
+ `/words` turns a 256-bit hash into a standard BIP39 phrase of 24 English
140
+ words. `/words N` does it for the last `N` hashes.
141
+
142
+ ```text
143
+ kredt@mshesh> /words
144
+ 2cf24dba5fb0a30e26e83b2ac5b9e29e1b161e5c1fa7425e73043362938b9824 [value=hello]
145
+ coconut mystery hub satoshi any mandate option alter client column judge
146
+ destroy ramp august idea visual drastic vicious scissors grocery circle
147
+ shift gauge naive
148
+ ```
149
+
150
+ This is an **encoding**, not decryption. The 24 words decode back to the exact
151
+ hash, but they cannot reveal `hello` — SHA-256 is still one-way. Random hashes
152
+ never had an input value to begin with.
153
+
154
+ The wordlist is the official BIP39 English list from
155
+ [bitcoin/bips](https://github.com/bitcoin/bips) (MIT).
156
+
157
+ ## Library use
158
+
159
+ ```python
160
+ from mshesh import Session, digest_to_phrase, hash_value, run_monitor
161
+
162
+ session = Session("kredt", record_path="live.txt")
163
+
164
+ session.add() # random hash
165
+ session.add("hello") # deterministic hash of "hello"
166
+ session.add_random(5) # five random hashes
167
+
168
+ print(digest_to_phrase(hash_value("hello"))) # 24 BIP39 words
169
+
170
+ session.save("whole-log.txt")
171
+ session.save("tail-log.txt", lines=20)
172
+
173
+ run_monitor(session, interval=5.0, value_chance=50, ticks=10)
174
+ ```
175
+
176
+ `run_monitor` also accepts `values=` (the value pool), `rng=`, `sleep=`, and
177
+ `emit=` hooks, which makes it easy to test or embed.
178
+
179
+ ## Development
180
+
181
+ ```bash
182
+ python3 -m unittest discover -s tests -v
183
+ ```
184
+
185
+ ## License
186
+
187
+ MIT
@@ -0,0 +1,165 @@
1
+ # mshesh
2
+
3
+ `mshesh` is a small terminal hash app. It asks for a username, then drops you
4
+ into a hash terminal:
5
+
6
+ - press **Enter on an empty line** → a fresh random hash;
7
+ - type **any text** → the SHA-256 hash of exactly that text;
8
+ - run **monitor mode** → hashes appear at randomized intervals;
9
+ - **record** every hash live, **save the whole log**, or **save only the last
10
+ N lines**;
11
+ - **translate** any hash into 24 BIP39 words with `/words`.
12
+
13
+ Hashes are 64 lowercase hex characters (SHA-256 output for value hashes and a
14
+ 32-byte `secrets` token for random hashes).
15
+
16
+ ## Install
17
+
18
+ From this folder:
19
+
20
+ ```bash
21
+ python3 -m pip install .
22
+ ```
23
+
24
+ For development:
25
+
26
+ ```bash
27
+ python3 -m pip install -e ".[dev]"
28
+ ```
29
+
30
+ This installs the `mshesh` command. You can also run it without installing:
31
+
32
+ ```bash
33
+ PYTHONPATH=src python3 -m mshesh
34
+ ```
35
+
36
+ ## Usage
37
+
38
+ ```bash
39
+ mshesh
40
+ ```
41
+
42
+ ```text
43
+ username: kredt
44
+ mshesh 0.1.0.1 | hash terminal
45
+ user: kredt | log: /home/kredt/mshesh-log.txt
46
+ Enter = random hash | text = hash of text | /help for commands
47
+ kredt@mshesh>
48
+ 9f86d081884c7d659a2feaa0c55ad015a3bf4f1b2b0b822cd15d6c15b0f00a08 sha256 [random]
49
+ kredt@mshesh> hello
50
+ 2cf24dba5fb0a30e26e83b2ac5b9e29e1b161e5c1fa7425e73043362938b9824 sha256 [value=hello]
51
+ ```
52
+
53
+ Use `//text` when you want to hash text that itself begins with a slash.
54
+
55
+ Print several random lines at once (all random, all logged):
56
+
57
+ ```text
58
+ kredt@mshesh> /random 3
59
+ 9f86d081884c7d659a2feaa0c55ad015a3bf4f1b2b0b822cd15d6c15b0f00a08 sha256 [random]
60
+ ...
61
+ ```
62
+
63
+ ### Commands
64
+
65
+ | Command | What it does |
66
+ | --- | --- |
67
+ | `/monitor [i] [chance] [n]` | Monitor mode. `i` is the standard interval in seconds, `chance` is an integer 0–100, `n` is an optional tick limit. `Ctrl+C` stops. |
68
+ | `/random N` | Print `N` random hash lines. They are also added to the log and any active recording. |
69
+ | `/words [N]` | Encode the latest hash, or the last `N` hashes, as 24 BIP39 words each. |
70
+ | `/record [path]` | Start (or keep) live recording of every new hash to a text file. Default: `./mshesh-record.txt`. |
71
+ | `/record off` | Stop live recording. |
72
+ | `/save [path]` | Save the whole in-memory log. Default: `./mshesh-log.txt`. |
73
+ | `/save-lines N [path]` | Save only the last `N` lines of the log. |
74
+ | `/log [N]` | Show the whole log or only its last `N` lines. |
75
+ | `/user [name]` | Show or change the username. |
76
+ | `/status` | Show user, hash count, log path, and recording path. |
77
+ | `/clear` | Clear the terminal and redraw the banner. |
78
+ | `/help` | Show command help. |
79
+ | `/quit` | Leave the terminal (`Ctrl+D` also works). |
80
+
81
+ Log and recording lines are pipe-delimited:
82
+
83
+ ```text
84
+ 2026-11-25T03:04:05 | kredt | value=hello | 2cf24dba5fb0a30e26e83b2ac5b9e29e1b161e5c1fa7425e73043362938b9824
85
+ 2026-11-25T03:04:09 | kredt | random | 9f86d081884c7d659a2feaa0c55ad015a3bf4f1b2b0b822cd15d6c15b0f00a08
86
+ ```
87
+
88
+ ## Monitor mode
89
+
90
+ ```bash
91
+ mshesh --monitor --interval 5 --value-chance 60
92
+ ```
93
+
94
+ or from inside the terminal:
95
+
96
+ ```text
97
+ kredt@mshesh> /monitor 5 60
98
+ monitor: every ~5s | value chance 60% | Ctrl+C to stop
99
+ ```
100
+
101
+ The **standard monitoring time** is `5.0` seconds. Each delay is jittered
102
+ between 60% and 140% of that value, so the monitor never beats at a perfectly
103
+ fixed rate.
104
+
105
+ The integer `value_chance` (0–100) decides, per tick, whether that particular
106
+ instance supplies a value:
107
+
108
+ - **value supplied** → hash of a word from the built-in value pool, plus an
109
+ extra randomized half-interval delay (more time randomization);
110
+ - **no value** → a random hash.
111
+
112
+ `0` means "always random"; `100` means "always hash a supplied value".
113
+ `/monitor 5 60 10` runs ten ticks and stops by itself.
114
+
115
+ ## Word encoding
116
+
117
+ `/words` turns a 256-bit hash into a standard BIP39 phrase of 24 English
118
+ words. `/words N` does it for the last `N` hashes.
119
+
120
+ ```text
121
+ kredt@mshesh> /words
122
+ 2cf24dba5fb0a30e26e83b2ac5b9e29e1b161e5c1fa7425e73043362938b9824 [value=hello]
123
+ coconut mystery hub satoshi any mandate option alter client column judge
124
+ destroy ramp august idea visual drastic vicious scissors grocery circle
125
+ shift gauge naive
126
+ ```
127
+
128
+ This is an **encoding**, not decryption. The 24 words decode back to the exact
129
+ hash, but they cannot reveal `hello` — SHA-256 is still one-way. Random hashes
130
+ never had an input value to begin with.
131
+
132
+ The wordlist is the official BIP39 English list from
133
+ [bitcoin/bips](https://github.com/bitcoin/bips) (MIT).
134
+
135
+ ## Library use
136
+
137
+ ```python
138
+ from mshesh import Session, digest_to_phrase, hash_value, run_monitor
139
+
140
+ session = Session("kredt", record_path="live.txt")
141
+
142
+ session.add() # random hash
143
+ session.add("hello") # deterministic hash of "hello"
144
+ session.add_random(5) # five random hashes
145
+
146
+ print(digest_to_phrase(hash_value("hello"))) # 24 BIP39 words
147
+
148
+ session.save("whole-log.txt")
149
+ session.save("tail-log.txt", lines=20)
150
+
151
+ run_monitor(session, interval=5.0, value_chance=50, ticks=10)
152
+ ```
153
+
154
+ `run_monitor` also accepts `values=` (the value pool), `rng=`, `sleep=`, and
155
+ `emit=` hooks, which makes it easy to test or embed.
156
+
157
+ ## Development
158
+
159
+ ```bash
160
+ python3 -m unittest discover -s tests -v
161
+ ```
162
+
163
+ ## License
164
+
165
+ MIT
@@ -0,0 +1,43 @@
1
+ [build-system]
2
+ requires = ["setuptools>=61.0", "wheel"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "mshesh"
7
+ version = "0.1.0.1"
8
+ description = "mshesh // a tiny hash terminal with random hashes, value hashes, and a jittered monitor"
9
+ readme = "README.md"
10
+ license = "MIT"
11
+ license-files = ["LICENSE"]
12
+ requires-python = ">=3.8"
13
+ authors = [
14
+ { name = "tderk" }
15
+ ]
16
+ keywords = ["hash", "sha256", "terminal", "monitor", "logging", "cli"]
17
+ classifiers = [
18
+ "Environment :: Console",
19
+ "Intended Audience :: End Users/Desktop",
20
+ "Programming Language :: Python :: 3",
21
+ "Topic :: Security :: Cryptography",
22
+ "Topic :: Terminals",
23
+ "Topic :: Utilities",
24
+ ]
25
+ dependencies = []
26
+
27
+ [project.optional-dependencies]
28
+ dev = ["build", "twine", "pytest>=7"]
29
+
30
+ [project.scripts]
31
+ mshesh = "mshesh.cli:main"
32
+
33
+ [tool.setuptools]
34
+ package-dir = { "" = "src" }
35
+ include-package-data = false
36
+
37
+ [tool.setuptools.packages.find]
38
+ where = ["src"]
39
+ include = ["mshesh*"]
40
+ exclude = ["tests*", "docs*", "dist*", "build*"]
41
+
42
+ [tool.setuptools.package-data]
43
+ mshesh = ["py.typed", "data/*.txt"]
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,47 @@
1
+ """mshesh - a tiny hash terminal with random hashes, value hashes, and a monitor."""
2
+
3
+ from __future__ import annotations
4
+
5
+ from .hashing import ALGORITHM, HASH_HEX_LENGTH, hash_value, is_hash, random_hash
6
+ from .monitor import (
7
+ DEFAULT_VALUE_CHANCE,
8
+ DEFAULT_VALUES,
9
+ STANDARD_MONITOR_INTERVAL,
10
+ clamp_chance,
11
+ next_delay,
12
+ run_monitor,
13
+ )
14
+ from .session import DEFAULT_LOG_NAME, DEFAULT_RECORD_NAME, Entry, Session
15
+ from .words import (
16
+ digest_to_phrase,
17
+ digest_to_words,
18
+ phrase_to_digest,
19
+ wordlist,
20
+ words_to_digest,
21
+ )
22
+
23
+ __version__ = "0.1.0.1"
24
+
25
+ __all__ = [
26
+ "ALGORITHM",
27
+ "HASH_HEX_LENGTH",
28
+ "DEFAULT_LOG_NAME",
29
+ "DEFAULT_RECORD_NAME",
30
+ "DEFAULT_VALUE_CHANCE",
31
+ "DEFAULT_VALUES",
32
+ "STANDARD_MONITOR_INTERVAL",
33
+ "Entry",
34
+ "Session",
35
+ "clamp_chance",
36
+ "digest_to_phrase",
37
+ "digest_to_words",
38
+ "hash_value",
39
+ "is_hash",
40
+ "next_delay",
41
+ "phrase_to_digest",
42
+ "random_hash",
43
+ "run_monitor",
44
+ "wordlist",
45
+ "words_to_digest",
46
+ "__version__",
47
+ ]
@@ -0,0 +1,6 @@
1
+ """Allow ``python -m mshesh``."""
2
+
3
+ from .cli import main
4
+
5
+ if __name__ == "__main__":
6
+ raise SystemExit(main())