functionality for charsets added
This commit is contained in:
@@ -18,6 +18,7 @@ himi # generate → clipboard
|
||||
himi -o # generate → clipboard + stdout
|
||||
himi -o secure # use 'secure' template → clipboard + stdout
|
||||
himi -n 5 -o easy # generate 5 'easy' secrets → clipboard + stdout
|
||||
himi -q # stdout only, skip clipboard (or HIMI_NO_CLIP=1)
|
||||
himi test '{word}-{num:2}' # test a custom template
|
||||
```
|
||||
|
||||
@@ -93,9 +94,29 @@ TEMPLATES=(
|
||||
| `{safe:N}` | N chars, ultra-safe (no ambiguous chars) | ~4.6 bits/char |
|
||||
| `{num:N}` | N digits | ~3.3 bits/char |
|
||||
| `{special:N}` | N from `!?@#%~=+` | ~3.0 bits/char |
|
||||
| `{NAME:N-M}` | N to M chars from charset NAME | log2(Σ size^L) |
|
||||
|
||||
\* Word entropy depends on pool size. Values shown assume all built-in lists enabled (~14k words, ~13.8 bits/word).
|
||||
|
||||
### Custom charsets
|
||||
|
||||
Add `"name|characters"` entries to `CHARSETS` in the config, then use `{name:N}` or `{name:N-M}` in any template:
|
||||
|
||||
```bash
|
||||
CHARSETS=(
|
||||
"hex|0123456789abcdef"
|
||||
"b58|123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"
|
||||
)
|
||||
```
|
||||
|
||||
Names must match `[a-z][a-z0-9_]*` and override the built-in four (alpha, safe, num, special). Avoid duplicate characters; himi warns if it sees them, since they skew the distribution and overstate entropy.
|
||||
|
||||
Range tokens pick the length weighted by `size^L`, so every possible output is equally likely. `{num:1-2}` covers 0-99 plus 0-9 (110 outcomes, ~6.8 bits), not a 50/50 coin flip on length, which would tank min-entropy.
|
||||
|
||||
### Integrity checks
|
||||
|
||||
`himi rebuild` records a SHA-256 of the pool; generation refuses if `pool.txt` was modified outside of himi (accidental edits, sync corruption, casual tampering). himi also refuses to source a config file that isn't owned by you or is group/world-writable, since the config is executed shell. Neither check stops an attacker who can already write to your home directory (nothing can), but they catch everything short of that.
|
||||
|
||||
## Entropy rules of thumb
|
||||
|
||||
| Bits | Strength | Use case |
|
||||
|
||||
Reference in New Issue
Block a user