Files
haiperdohp-jemaytreeah/tools/README.md
T
malonehunter d5c5cab184 v2.1: DB restoration (209k entries), cipher fixes & renames, generator tools
- Restore ~64k entries removed by earlier over-aggressive cleanup
  (alphabet ends A/B/C/X/Y/Z) plus specialty dbs and Thelemic recovery
- Fix case-sensitivity bug in precomputed values (Capitals/Alphanumeric Case Sensitive)
- Fix bracket-annotation over-counting in digit-aware ciphers
- Sort db alphabetically so added entries surface in match lists
- Rename Latin->Latin (Jewish), Alphanumeric Satanic->Alphanumeric Case Sensitive
- UI: text selection no longer minimizes the modal
- Add tools/ generator to rebuild db.json from db.txt
2026-05-24 18:06:43 -04:00

31 lines
1.3 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# Tools
## Rebuilding the precomputed database (`db.json`)
The calculator works out of the box in **live mode** — it loads `db.txt` (one phrase per
line) and computes cipher values on the fly. For **instant matching** (~100ms vs 2–5s per
query), it can instead load a precomputed `db.json` containing all 69 cipher values per entry.
`db.json` is a build artifact derived from `db.txt` + `calc/ciphers.js`. It is not committed
to the repo (it's large). Two ways to get it:
1. **Download** the prebuilt `db.json` from the latest [GitHub Release](../../releases).
Place it next to `index.html`.
2. **Regenerate** it yourself:
```sh
python3 tools/generate_db_json.py db.txt db.json
```
Requires Python 3. Reads cipher definitions from `calc/ciphers.js`, scores every entry in
`db.txt` against all 69 English-applicable ciphers, and writes `db.json`.
The calculator auto-detects `db.json` (see `databaseMode` in `config.js`, default `"auto"`):
it tries `db.json` first and falls back to `db.txt` if absent.
## Files
- `generate_db_json.py` — builds `db.json` from a flat `db.txt`.
- `all_ciphers.py` — parses `calc/ciphers.js` and scores text against all English ciphers
(used by the generator). Handles case-sensitive ciphers and strips `[...]` display
annotations before scoring, matching the live engine.