You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 483643f
Browse filesBrowse the repository at this point in the historyBrowse files
[**CodExt**](https://github.com/dhondta/python-codext) is a library (Python 3.10 or later) that extends the native [`codecs`](https://docs.python.org/3/library/codecs) library (namely for adding new custom encodings and character mappings) and provides **120+ new codecs**, hence its name combining *CODecs EXTension*. It also features a **guess mode** for decoding multiple layers of encoding and **CLI tools** for convenience.
14
+
[**CodExt**](https://github.com/dhondta/python-codext) is a library (Python 3.10 or later) that extends the native [`codecs`](https://docs.python.org/3/library/codecs) library (namely for adding new custom encodings and character mappings) and provides **150+ new codecs**, hence its name combining *CODecs EXTension*. It also features a **guess mode** for decoding multiple layers of encoding and **CLI tools** for convenience.
Copy file name to clipboardExpand all lines: docs/pages/guessing.md
+22Lines changed: 22 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -181,3 +181,25 @@ This "textness" depends on the script of the letters. For Latin letters, it is m
181
181
182
182
This part shall still be improved with better features and/or using machine learning. In particular, the default stop function (`text`) accepts any printable output with a low entropy, hence possibly an intermediate result of a chain of encodings.
183
183
184
+
### Strength Evaluation
185
+
186
+
While the guess mode tries to *reverse* an unknown chain of codecs, the strength feature does the opposite: given a chain, it estimates how hard that chain is to reverse. It rates resistance to codext's own guessing heuristic and to casual recognition - not cryptographic strength.
187
+
188
+
It encodes a sample through the chain, then walks the true decoding path and, at each layer, uses the ranking heuristic (see above) to measure how high the correct codec is ranked. A layer ranked first is an obvious give-away ; a deeply-ranked or non-surfaced ("blind") layer, e.g. one whose codec opts out of guessing, cannot be greedily followed. It also flags an output that still looks like a text (a disguise) and a lossy chain (e.g. a hash) whose plaintext cannot be recovered at all.
189
+
190
+
The result is a score from 0 (trivially reversible) to 100 (resists the guesser) with a letter grade, the per-layer ranks and notes pointing at the weakest layer:
A compatible sample is chosen automatically ; a specific one can be given with the `sample` keyword-argument. The `include`/`exclude` arguments scope the codecs the guesser may use, exactly like for the guess mode. With the [CLI tool](cli.md), the chain is given as arguments and the sample is read from stdin or a file (a default is used otherwise): `codext strength base64 gzip`.
202
+
203
+
!!! note "Not cryptographic strength"
204
+
205
+
This measures resistance to codext's guessing/ranking and to casual inspection, not cryptographic security. The per-layer ranking is used on purpose instead of the full recursive guess, which is combinatorially expensive on some chains.
0 commit comments