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
Copy file name to clipboardExpand all lines: docs/features.md
+19-2Lines changed: 19 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -295,13 +295,20 @@ An example of a 2-stages base64- then base62-encoded string:
295
295
('FKU2Ng7lJbR>.IHuzLDv17eLhE6', ('barbie',))
296
296
```
297
297
298
-
In the second example, we can see that the given encoded string isnot decoded as expected. This is the case because the stop condition (default) is too broad. If we have a prior knowledge on what we should expect, we can input a simple string or a regex:
298
+
In the second example, we can see that the given encoded string isnot decoded as expected. This is the case because the (default) stop condition is too broadand stops ifall the characters of the output are printable. If we have a prior knowledge on what we should expect, we can input a simple string or a regex:
Instead of a string, we can also pass a function. For this purpose, standard stop functions are predefined in the `stopfunc` submodule. So, we can for instance use `stopfunc.lang_en` to stop when we find something that is English (only works if [`langdetect`](https://pypi.org/project/langdetect/) is installed). Note that working this way gives lots of false positives if the text is very short like in the example case. That's why the `codec_categories` argument is used to only consider baseX codecs. This is also demonstrated in the next examples.
If we know the first encoding, we can set this in the `found` parameter to save time:
306
313
307
314
```python
@@ -325,7 +332,17 @@ Another example of 2-stages encoded string:
325
332
('this is a test', ('base64', 'morse'))
326
333
```
327
334
328
-
Note that the first call takes much longer than the second one but requires no knowledge about the possible [categories](#list-codecs) of encodings.
335
+
!!! warning "Computation time"
336
+
337
+
Note that, in the very last examples, the first call takes much longer than the second one but requires no knowledge about the possible [categories](#list-codecs) of encodings.
338
+
339
+
!!! note "Stop functions"
340
+
341
+
Currently, a few standard stop functions are provided with the `stopfunc` submodule:
342
+
343
+
-`flag`: searches for the pattern "`[Ff][Ll1][Aa4@][Gg9]`" (either UTF-8orUTF-16)
344
+
-`lang_**`: checks if the given lang (anyfrom the [`PROFILES_DIRECTORY`](https://github.com/Mimino666/langdetect/tree/master/langdetect/profiles) of the [`langdetect` module](https://github.com/Mimino666/langdetect)) is detected (note that it first checks ifall characters are printable)
345
+
-`printables`: checks that every output character isin the set of printables
0 commit comments