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/enc/binary.md
+1-7Lines changed: 1 addition & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,10 +1,4 @@
1
-
With `codext`, the `codecs` library has multiple new encodings in addition to [the native ones](https://docs.python.org/3.8/library/codecs.html#standard-encodings), like presented hereafter.
2
-
3
-
Unless explicitely specified, each codec supports writing to and reading from a file.
4
-
5
-
!!! warning "Lossy conversion"
6
-
7
-
Some encodings are lossy, meaning that it is not always possible to decode back to the exact start string. This should be considered especially when chaining codecs.
1
+
`codext` also adds common binary encodings. For instance, the Manchester code, that encodes digits, is applied to the ordinals of the input text and the resulting binary stream is converted back to characters.
Copy file name to clipboardExpand all lines: docs/enc/common.md
+1-7Lines changed: 1 addition & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,10 +1,4 @@
1
-
With `codext`, the `codecs` library has multiple new encodings in addition to [the native ones](https://docs.python.org/3.8/library/codecs.html#standard-encodings), like presented hereafter.
2
-
3
-
Unless explicitely specified, each codec supports writing to and reading from a file.
4
-
5
-
!!! warning "Lossy conversion"
6
-
7
-
Some encodings are lossy, meaning that it is not always possible to decode back to the exact start string. This should be considered especially when chaining codecs.
1
+
`codext` also provides some very common encodings, for the sake of simplicity (e.g. while chaining codecs with [the CLI tool](../cli.html)).
Copy file name to clipboardExpand all lines: docs/enc/crypto.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,4 +1,4 @@
1
-
`codext` also implements several simple cryptographic ciphersthat are comparable to encodingsfor each value of their keys as these are too weak.
1
+
`codext` also implements several simple cryptographic ciphers. But how does it relate to encoding while a key is required ? `codext` focuses on ciphers that have a weak key. With dynamically named encodings, it is then possible to define a bunch of encodings, one for each value of the key. For instance, Barbie Typewriter has a key with only 4 possible values. The `barbie` codec can then be `barbie-1`, ..., `barbie-4`.
Copy file name to clipboardExpand all lines: docs/enc/languages.md
+2-8Lines changed: 2 additions & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,10 +1,4 @@
1
-
With `codext`, the `codecs` library has multiple new encodings in addition to [the native ones](https://docs.python.org/3.8/library/codecs.html#standard-encodings), like presented hereafter.
2
-
3
-
Unless explicitely specified, each codec supports writing to and reading from a file.
4
-
5
-
!!! warning "Lossy conversion"
6
-
7
-
Some encodings are lossy, meaning that it is not always possible to decode back to the exact start string. This should be considered especially when chaining codecs.
1
+
`codext` also adds some common languages for encoding.
8
2
9
3
-----
10
4
@@ -71,7 +65,7 @@ It supports of course letters and digits, but also a few special characters: `.,
71
65
72
66
-----
73
67
74
-
### Navajo Code
68
+
### Navajo
75
69
76
70
It implements the letters from the [Navajo Code Talkers' Dictionary](https://www.history.navy.mil/research/library/online-reading-room/title-list-alphabetically/n/navajo-code-talker-dictionary.html). It conserves digits and newlines.
Copy file name to clipboardExpand all lines: docs/enc/others.md
+1-7Lines changed: 1 addition & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,10 +1,4 @@
1
-
With `codext`, the `codecs` library has multiple new encodings in addition to [the native ones](https://docs.python.org/3.8/library/codecs.html#standard-encodings), like presented hereafter.
2
-
3
-
Unless explicitely specified, each codec supports writing to and reading from a file.
4
-
5
-
!!! warning "Lossy conversion"
6
-
7
-
Some encodings are lossy, meaning that it is not always possible to decode back to the exact start string. This should be considered especially when chaining codecs.
1
+
All kinds of other codecs are categorized in "*Others*".
Copy file name to clipboardExpand all lines: docs/enc/stegano.md
+2-8Lines changed: 2 additions & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,10 +1,4 @@
1
-
With `codext`, the `codecs` library has multiple new encodings in addition to [the native ones](https://docs.python.org/3.8/library/codecs.html#standard-encodings), like presented hereafter.
2
-
3
-
Unless explicitely specified, each codec supports writing to and reading from a file.
4
-
5
-
!!! warning "Lossy conversion"
6
-
7
-
Some encodings are lossy, meaning that it is not always possible to decode back to the exact start string. This should be considered especially when chaining codecs.
1
+
`codext` defines a few steganography-related encodings. While encoding is not really steganography (that is, concealing data within data), the following codecs are worth creating this category as they relate to converting data into something that could mislead the unaware reader.
8
2
9
3
-----
10
4
@@ -48,7 +42,7 @@ This codec implements the SMS encoding, also caled T9, that is the conversion fr
48
42
49
43
This simple encoding replaces zeros and ones of the binary version of the input text with spaces and tabs. It is supported either with its original mapping or with the inverted mapping.
50
44
51
-
!!! warning "Do not confuse"
45
+
!!! warning "Encoding, not programming !"
52
46
53
47
This should not be confused with the [whitespace esoteric language](https://en.wikipedia.org/wiki/Whitespace_(programming_language)).
With `codext`, the `codecs` library has multiple new encodings in addition to [the native ones](https://docs.python.org/3.8/library/codecs.html#standard-encodings).
2
+
3
+
Unless explicitely specified, each codec supports writing to and reading from a file.
4
+
5
+
!!! warning "Lossy conversion"
6
+
7
+
Some encodings are lossy, meaning that it is not always possible to decode back to the exact start string. This should be considered especially when chaining codecs.
Copy file name to clipboardExpand all lines: docs/features.md
+47-36Lines changed: 47 additions & 36 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -78,44 +78,13 @@ In this second example, we can see that:
78
78
79
79
- Only the encoding function is defined.
80
80
- A pattern is defined to match the prefix "`mydyn-`" and then an integer which is captured and used with `mydyncodec_encode(i)`.
81
-
- The `text=True` keyword-argument could have been used to only support text de/encoding and not file handling.
82
81
83
82
!!! warning "Pattern capture group"
84
83
85
84
A capture group means that the parameter will be used with a dynamic (decorated) encoding function. In order to avoid this, i.e. for matching multiple names leading to the same encoding while calling a static encoding function, we can simply define a non-capturing group, e.g. "`(?:my|special_)codec`".
86
85
87
86
-----
88
87
89
-
## Search for encodings
90
-
91
-
Natively, `codecs` provides a `lookup` function that allows to get the `CodecInfo` object for the desired encoding. This performs a lookup in the registry based on an exact match. Sometimes, it can be useful to search for available encodings based on a regular expression. Therefore, a `search` function is added by `codext` to allow to get a list of encoding names matching the input regex.
The `search` function relies on `codext`'s registry and not the native one, hence returning only regex matches for new encodings added with `codext` and an exact match by also using the `lookup` function.
105
-
106
-
Also, `codext` provides an `examples` function to get some examples of valid encoding names. This is especially useful when it concerns dynamicly named encodings (e.g. `rot`, `shift` or `dna`).
@@ -185,6 +155,47 @@ In this second example, we can see that:
185
155
- The case is ignored ; decoding either "`abcd`"or"`ABCD`" will succeed.
186
156
- The binary mode is enabled, meaning that the input text is converted to a binary string for encoding, while it is converted from binary to text when decoding.
187
157
158
+
!!! warning "Input/Output types"
159
+
160
+
By default, when `intype`is defined, `outype` takes the same value. So, if the new encoding uses a pre-conversion to bits (`intype="bin"`) but maps bits to characters (therefore binary conversion to text isnot needed), `outype` shall then be set to "`str`" (orif it maps bits to ordinals, use `outype="ord"`).
161
+
162
+
-----
163
+
164
+
## List new encodings
165
+
166
+
New codecs added with`codext` can be listed with the related function. Note that it only lists new codecs, not native ones.
Natively, `codecs` provides a `lookup` function that allows to get the `CodecInfo`objectfor the desired encoding. This performs a lookup in the registry based on an exact match. Sometimes, it can be useful to search for available encodings based on a regular expression. Therefore, a `search` function is added by `codext` to allow to get a list of encoding names matching the input regex.
Also, `codext` provides an `examples` function to get some examples of valid encoding names. This is especially useful when it concerns dynamicly named encodings (e.g. `rot`, `shift`or`dna`).
0 commit comments