rtty-soda 0.3.11__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (33) hide show
  1. rtty_soda-0.3.11/PKG-INFO +348 -0
  2. rtty_soda-0.3.11/README.md +322 -0
  3. rtty_soda-0.3.11/pyproject.toml +110 -0
  4. rtty_soda-0.3.11/src/rtty_soda/__init__.py +0 -0
  5. rtty_soda-0.3.11/src/rtty_soda/archivers.py +79 -0
  6. rtty_soda-0.3.11/src/rtty_soda/cli/__init__.py +6 -0
  7. rtty_soda-0.3.11/src/rtty_soda/cli/cli_options.py +118 -0
  8. rtty_soda-0.3.11/src/rtty_soda/cli/cli_reader.py +25 -0
  9. rtty_soda-0.3.11/src/rtty_soda/cli/cli_writer.py +41 -0
  10. rtty_soda-0.3.11/src/rtty_soda/cli/main.py +417 -0
  11. rtty_soda-0.3.11/src/rtty_soda/cli/main.pyi +111 -0
  12. rtty_soda-0.3.11/src/rtty_soda/cryptography/__init__.py +0 -0
  13. rtty_soda-0.3.11/src/rtty_soda/cryptography/kdf.py +49 -0
  14. rtty_soda-0.3.11/src/rtty_soda/cryptography/public.py +20 -0
  15. rtty_soda-0.3.11/src/rtty_soda/cryptography/secret.py +20 -0
  16. rtty_soda-0.3.11/src/rtty_soda/encoders/__init__.py +33 -0
  17. rtty_soda-0.3.11/src/rtty_soda/encoders/base10_encoder.py +14 -0
  18. rtty_soda-0.3.11/src/rtty_soda/encoders/base26_encoder.py +18 -0
  19. rtty_soda-0.3.11/src/rtty_soda/encoders/base31_encoder.py +16 -0
  20. rtty_soda-0.3.11/src/rtty_soda/encoders/base36_encoder.py +18 -0
  21. rtty_soda-0.3.11/src/rtty_soda/encoders/base64_encoder.py +16 -0
  22. rtty_soda-0.3.11/src/rtty_soda/encoders/base94_encoder.py +16 -0
  23. rtty_soda-0.3.11/src/rtty_soda/encoders/encoder.py +11 -0
  24. rtty_soda-0.3.11/src/rtty_soda/encoders/functions.py +51 -0
  25. rtty_soda-0.3.11/src/rtty_soda/encoders/scsu.py +14 -0
  26. rtty_soda-0.3.11/src/rtty_soda/formatters.py +44 -0
  27. rtty_soda-0.3.11/src/rtty_soda/interfaces.py +19 -0
  28. rtty_soda-0.3.11/src/rtty_soda/py.typed +0 -0
  29. rtty_soda-0.3.11/src/rtty_soda/services/__init__.py +14 -0
  30. rtty_soda-0.3.11/src/rtty_soda/services/encoding_service.py +29 -0
  31. rtty_soda-0.3.11/src/rtty_soda/services/encryption_service.py +137 -0
  32. rtty_soda-0.3.11/src/rtty_soda/services/key_service.py +43 -0
  33. rtty_soda-0.3.11/src/rtty_soda/services/service.py +57 -0
@@ -0,0 +1,348 @@
1
+ Metadata-Version: 2.3
2
+ Name: rtty-soda
3
+ Version: 0.3.11
4
+ Summary: A CLI tool for Unix-like environments to encrypt a RTTY session using NaCl
5
+ Keywords: cli,encryption,libsodium,nacl,rtty
6
+ Author: Theo Saveliev
7
+ Author-email: Theo Saveliev <89431871+theosaveliev@users.noreply.github.com>
8
+ License: MIT
9
+ Classifier: Development Status :: 4 - Beta
10
+ Classifier: Programming Language :: Python :: 3.14
11
+ Classifier: Operating System :: POSIX
12
+ Classifier: Environment :: Console
13
+ Classifier: License :: OSI Approved :: MIT License
14
+ Classifier: Topic :: Security :: Cryptography
15
+ Classifier: Topic :: Utilities
16
+ Requires-Dist: brotli>=1.2.0,<2.0.0
17
+ Requires-Dist: pynacl>=1.6.0,<2.0.0
18
+ Requires-Dist: scsu>=1.1.1,<2.0.0
19
+ Requires-Dist: click>=8.3.0,<9.0.0 ; extra == 'cli'
20
+ Requires-Dist: click-aliases>=1.0.5,<2.0.0 ; extra == 'cli'
21
+ Requires-Python: >=3.14, <4.0
22
+ Project-URL: github, https://github.com/theosaveliev/rtty-soda
23
+ Project-URL: issues, https://github.com/theosaveliev/rtty-soda/issues
24
+ Provides-Extra: cli
25
+ Description-Content-Type: text/markdown
26
+
27
+ # rtty-soda
28
+
29
+ A CLI tool for Unix-like environments to encrypt a RTTY session using NaCl.
30
+
31
+
32
+ #### Features
33
+
34
+ - Public Key encryption (Curve25519-XSalsa20-Poly1305)
35
+ - Secret Key encryption (XSalsa20-Poly1305)
36
+ - Key derivation (Argon2id-Blake2b)
37
+ - Text compression (brotli, zstd, zlib, bz2, lzma)
38
+ - Custom encodings:
39
+ - Base10 (Decimal)
40
+ - Base26 (Latin)
41
+ - Base31 (Cyrillic)
42
+ - Base36 (Latin with numbers)
43
+ - Base64 (RFC 4648)
44
+ - Base94 (ASCII printable)
45
+ - Binary
46
+
47
+
48
+ ## Installation
49
+ #### Package manager
50
+
51
+ 1. [Install uv](https://docs.astral.sh/uv/getting-started/installation/)
52
+ 2. Install rtty-soda:
53
+ ```
54
+ % uv tool install "rtty-soda[cli]"
55
+ ```
56
+ 3. Remove rtty-soda:
57
+ ```
58
+ % uv tool uninstall rtty-soda
59
+ ```
60
+
61
+ #### Docker
62
+
63
+ ```
64
+ % docker run -it --rm -h rtty-soda -v .:/app/host nett/rtty-soda:0.3.11
65
+ % docker run -it --rm -h rtty-soda -v .:/app/host nett/rtty-soda:0.3.11-tools
66
+ ```
67
+
68
+
69
+ ## Getting help
70
+
71
+ All commands have `[-h | --help]` option.
72
+
73
+ ```
74
+ % soda
75
+ <frozen importlib._bootstrap>:491: RuntimeWarning: The global interpreter lock (GIL) has been enabled to load module '_brotli', which has not declared that it can run safely without the GIL. To override this behavior and keep the GIL disabled (at your own risk), run with PYTHON_GIL=0 or -Xgil=0.
76
+ Usage: soda [OPTIONS] COMMAND [ARGS]...
77
+
78
+ Options:
79
+ --version Show the version and exit.
80
+ -h, --help Show this message and exit.
81
+
82
+ Commands:
83
+ decrypt-password (dp) Decrypt Message (Password).
84
+ decrypt-public (d) Decrypt Message (Public).
85
+ decrypt-secret (ds) Decrypt Message (Secret).
86
+ encode Encode File.
87
+ encrypt-password (ep) Encrypt Message (Password).
88
+ encrypt-public (e) Encrypt Message (Public).
89
+ encrypt-secret (es) Encrypt Message (Secret).
90
+ genkey Generate Private Key.
91
+ kdf Key Derivation Function.
92
+ pubkey Get Public Key.
93
+ ```
94
+
95
+ Some commands have aliases, so `% soda encrypt-password ...` and `% soda ep ...`
96
+ are equivalent.
97
+
98
+
99
+ ## Public Key encryption
100
+ #### Key generation
101
+
102
+ ```
103
+ % soda genkey | tee alice | soda pubkey - | tee alice_pub
104
+ <frozen importlib._bootstrap>:491: RuntimeWarning: The global interpreter lock (GIL) has been enabled to load module '_brotli', which has not declared that it can run safely without the GIL. To override this behavior and keep the GIL disabled (at your own risk), run with PYTHON_GIL=0 or -Xgil=0.
105
+ <frozen importlib._bootstrap>:491: RuntimeWarning: The global interpreter lock (GIL) has been enabled to load module '_brotli', which has not declared that it can run safely without the GIL. To override this behavior and keep the GIL disabled (at your own risk), run with PYTHON_GIL=0 or -Xgil=0.
106
+ HT6UNhua+slsp+GBWyIiLjw55iWGOSvgdHtOaidbQSc=
107
+
108
+ % soda genkey | tee bob | soda pubkey - | tee bob_pub
109
+ <frozen importlib._bootstrap>:491: RuntimeWarning: The global interpreter lock (GIL) has been enabled to load module '_brotli', which has not declared that it can run safely without the GIL. To override this behavior and keep the GIL disabled (at your own risk), run with PYTHON_GIL=0 or -Xgil=0.
110
+ <frozen importlib._bootstrap>:491: RuntimeWarning: The global interpreter lock (GIL) has been enabled to load module '_brotli', which has not declared that it can run safely without the GIL. To override this behavior and keep the GIL disabled (at your own risk), run with PYTHON_GIL=0 or -Xgil=0.
111
+ 8+tcGctkBSSCsWv6oGduS5/DcCdKx4A6GOiEfBiyBWE=
112
+
113
+ % soda genkey -h
114
+ <frozen importlib._bootstrap>:491: RuntimeWarning: The global interpreter lock (GIL) has been enabled to load module '_brotli', which has not declared that it can run safely without the GIL. To override this behavior and keep the GIL disabled (at your own risk), run with PYTHON_GIL=0 or -Xgil=0.
115
+ Usage: soda genkey [OPTIONS]
116
+
117
+ Generate Private Key.
118
+
119
+ Encoding: base10 | base26 | base31 | base36 | base64 | base94 | binary
120
+
121
+ Options:
122
+ -e, --encoding TEXT [default: base64]
123
+ -o, --output-file FILE Write output to file.
124
+ -g, --group-len INTEGER [default: 0]
125
+ --line-len INTEGER [default: 80]
126
+ --padding INTEGER [default: 0]
127
+ -v, --verbose Show verbose output.
128
+ -h, --help Show this message and exit.
129
+ ```
130
+
131
+ #### Encryption
132
+
133
+ Alice sends the message to Bob:
134
+
135
+ ```
136
+ % cat message
137
+ A telegraph key is a specialized electrical switch used by a trained operator to
138
+ transmit text messages in Morse code in a telegraphy system.
139
+ The first telegraph key was invented by Alfred Vail, an associate of Samuel Morse.
140
+ (c) Wikipedia
141
+
142
+ % soda encrypt-public alice bob_pub message | tee encrypted | cut -c 1-80
143
+ <frozen importlib._bootstrap>:491: RuntimeWarning: The global interpreter lock (GIL) has been enabled to load module '_brotli', which has not declared that it can run safely without the GIL. To override this behavior and keep the GIL disabled (at your own risk), run with PYTHON_GIL=0 or -Xgil=0.
144
+ lbu7UO4XgNUJcYKfX0IonastYWzwhL1h8OnW4Ks2nyTCwAsJK78NSa/iUqjmjGN9PlwXiDakvJHFigZD
145
+
146
+ % soda encrypt-public -h
147
+ <frozen importlib._bootstrap>:491: RuntimeWarning: The global interpreter lock (GIL) has been enabled to load module '_brotli', which has not declared that it can run safely without the GIL. To override this behavior and keep the GIL disabled (at your own risk), run with PYTHON_GIL=0 or -Xgil=0.
148
+ Usage: soda encrypt-public [OPTIONS] PRIVATE_KEY_FILE PUBLIC_KEY_FILE
149
+ MESSAGE_FILE
150
+
151
+ Encrypt Message (Public).
152
+
153
+ Encoding: base10 | base26 | base31 | base36 | base64 | base94 | binary
154
+
155
+ Compression: brotli | zstd | zlib | bz2 | lzma | raw
156
+
157
+ Options:
158
+ -t, --text Treat message as text (binary if not specified).
159
+ --key-encoding TEXT [default: base64]
160
+ -e, --data-encoding TEXT [default: base64]
161
+ -c, --compression TEXT [default: brotli]
162
+ -o, --output-file FILE Write output to file.
163
+ -g, --group-len INTEGER [default: 0]
164
+ --line-len INTEGER [default: 80]
165
+ --padding INTEGER [default: 0]
166
+ -v, --verbose Show verbose output.
167
+ -h, --help Show this message and exit.
168
+ ```
169
+
170
+ #### Decryption
171
+
172
+ ```
173
+ % soda decrypt-public bob alice_pub encrypted
174
+ <frozen importlib._bootstrap>:491: RuntimeWarning: The global interpreter lock (GIL) has been enabled to load module '_brotli', which has not declared that it can run safely without the GIL. To override this behavior and keep the GIL disabled (at your own risk), run with PYTHON_GIL=0 or -Xgil=0.
175
+ A telegraph key is a specialized electrical switch used by a trained operator to
176
+ transmit text messages in Morse code in a telegraphy system.
177
+ The first telegraph key was invented by Alfred Vail, an associate of Samuel Morse.
178
+ (c) Wikipedia
179
+ ```
180
+
181
+
182
+ ## Secret Key encryption
183
+
184
+ Alice and Bob share a key for symmetric encryption:
185
+
186
+ ```
187
+ % soda genkey > shared
188
+ <frozen importlib._bootstrap>:491: RuntimeWarning: The global interpreter lock (GIL) has been enabled to load module '_brotli', which has not declared that it can run safely without the GIL. To override this behavior and keep the GIL disabled (at your own risk), run with PYTHON_GIL=0 or -Xgil=0.% soda encrypt-secret shared message -o encrypted
189
+ % soda decrypt-secret shared encrypted -o message
190
+ ```
191
+
192
+ Another day, they share a password:
193
+
194
+ ```
195
+ % echo qwerty | soda encrypt-password - message -p interactive -o encrypted
196
+ % echo qwerty | soda decrypt-password - encrypted -p interactive -o message
197
+ ```
198
+
199
+
200
+ ## Key derivation
201
+
202
+ The KDF function derives the key from the password.
203
+ It accepts different profiles: interactive, moderate, and sensitive.
204
+
205
+ ```
206
+ % echo qwerty | soda kdf - -p interactive
207
+ <frozen importlib._bootstrap>:491: RuntimeWarning: The global interpreter lock (GIL) has been enabled to load module '_brotli', which has not declared that it can run safely without the GIL. To override this behavior and keep the GIL disabled (at your own risk), run with PYTHON_GIL=0 or -Xgil=0.
208
+ HqbvUXflAG+no3YS9njezZ3leyr8IwERAyeNoG2l41U=
209
+
210
+ % soda kdf -h
211
+ <frozen importlib._bootstrap>:491: RuntimeWarning: The global interpreter lock (GIL) has been enabled to load module '_brotli', which has not declared that it can run safely without the GIL. To override this behavior and keep the GIL disabled (at your own risk), run with PYTHON_GIL=0 or -Xgil=0.
212
+ Usage: soda kdf [OPTIONS] PASSWORD_FILE
213
+
214
+ Key Derivation Function.
215
+
216
+ Encoding: base10 | base26 | base31 | base36 | base64 | base94 | binary
217
+
218
+ Profile: interactive | moderate | sensitive
219
+
220
+ Options:
221
+ -e, --encoding TEXT [default: base64]
222
+ -p, --profile TEXT [default: sensitive]
223
+ -o, --output-file FILE Write output to file.
224
+ -g, --group-len INTEGER [default: 0]
225
+ --line-len INTEGER [default: 80]
226
+ --padding INTEGER [default: 0]
227
+ -v, --verbose Show verbose output.
228
+ -h, --help Show this message and exit.
229
+ ```
230
+
231
+ ![KDF diagram](https://github.com/theosaveliev/rtty-soda/raw/main/diagram/kdf.png)
232
+
233
+
234
+ ## Text compression
235
+
236
+ That works as follows:
237
+ 1. The plaintext is prepared:
238
+ - In binary mode (default), the message is read as bytes
239
+ - In text mode (`-t, --text`), the message is read as a string, stripped, and encoded with SCSU, reducing the size of Unicode messages by 15–50%
240
+ 2. The plaintext is compressed with the compression lib
241
+ 3. The 16-byte MAC and 24-byte nonce are added
242
+ 4. The result is encoded with Base64, which adds ~33% overhead
243
+
244
+ ```
245
+ % soda es shared message -t -v -c brotli > /dev/null
246
+ <frozen importlib._bootstrap>:491: RuntimeWarning: The global interpreter lock (GIL) has been enabled to load module '_brotli', which has not declared that it can run safely without the GIL. To override this behavior and keep the GIL disabled (at your own risk), run with PYTHON_GIL=0 or -Xgil=0.
247
+ Plaintext: 238
248
+ Ciphertext: 216
249
+ Overhead: 0.908
250
+ Groups: 1
251
+ % soda es shared message -t -v -c zstd > /dev/null
252
+ <frozen importlib._bootstrap>:491: RuntimeWarning: The global interpreter lock (GIL) has been enabled to load module '_brotli', which has not declared that it can run safely without the GIL. To override this behavior and keep the GIL disabled (at your own risk), run with PYTHON_GIL=0 or -Xgil=0.
253
+ Plaintext: 238
254
+ Ciphertext: 276
255
+ Overhead: 1.160
256
+ Groups: 1
257
+ % soda es shared message -t -v -c zlib > /dev/null
258
+ <frozen importlib._bootstrap>:491: RuntimeWarning: The global interpreter lock (GIL) has been enabled to load module '_brotli', which has not declared that it can run safely without the GIL. To override this behavior and keep the GIL disabled (at your own risk), run with PYTHON_GIL=0 or -Xgil=0.
259
+ Plaintext: 238
260
+ Ciphertext: 280
261
+ Overhead: 1.176
262
+ Groups: 1
263
+ % soda es shared message -t -v -c bz2 > /dev/null
264
+ <frozen importlib._bootstrap>:491: RuntimeWarning: The global interpreter lock (GIL) has been enabled to load module '_brotli', which has not declared that it can run safely without the GIL. To override this behavior and keep the GIL disabled (at your own risk), run with PYTHON_GIL=0 or -Xgil=0.
265
+ Plaintext: 238
266
+ Ciphertext: 336
267
+ Overhead: 1.412
268
+ Groups: 1
269
+ % soda es shared message -t -v -c lzma > /dev/null
270
+ <frozen importlib._bootstrap>:491: RuntimeWarning: The global interpreter lock (GIL) has been enabled to load module '_brotli', which has not declared that it can run safely without the GIL. To override this behavior and keep the GIL disabled (at your own risk), run with PYTHON_GIL=0 or -Xgil=0.
271
+ Plaintext: 238
272
+ Ciphertext: 320
273
+ Overhead: 1.345
274
+ Groups: 1
275
+ % soda es shared message -t -v -c raw > /dev/null
276
+ <frozen importlib._bootstrap>:491: RuntimeWarning: The global interpreter lock (GIL) has been enabled to load module '_brotli', which has not declared that it can run safely without the GIL. To override this behavior and keep the GIL disabled (at your own risk), run with PYTHON_GIL=0 or -Xgil=0.
277
+ Plaintext: 238
278
+ Ciphertext: 372
279
+ Overhead: 1.563
280
+ Groups: 1
281
+ ```
282
+
283
+
284
+ ## Encoding
285
+
286
+ The rtty-soda supports various encodings:
287
+
288
+ ```
289
+ % soda encrypt-public alice bob_pub message --data-encoding base36 --group-len 5 --text
290
+ <frozen importlib._bootstrap>:491: RuntimeWarning: The global interpreter lock (GIL) has been enabled to load module '_brotli', which has not declared that it can run safely without the GIL. To override this behavior and keep the GIL disabled (at your own risk), run with PYTHON_GIL=0 or -Xgil=0.
291
+ 513S7 9BLUG AVKLP S8PV8 GGOAJ I4ZG2 W0CLI O2H8J P270K Z36S0 17ZSN 4VJVR 0L2GL
292
+ QD3S3 K9LYV K1NTU 0QYYD IL032 60P67 U0NNO UY7S2 WO55O 6CNHV OMUEM IDFQ5 PIAIU
293
+ OHX15 1OM4H 4T1IR SAH2U V87ZS SC2TB IFE8X 3YB0H YUL2C LXQLW 37PJZ IJ50M JJH0X
294
+ VX8IM MQ4ON 9DRX2 RGX2J WXW1P RYHP9 G3AJ9 6PJOC DPREK 6ND5Q RHV
295
+ ```
296
+
297
+
298
+ ## Environment variables
299
+
300
+ Common options can be set in the environment variables:
301
+
302
+ ```
303
+ % cat ~/.soda/bin.env
304
+ SODA_TEXT=0
305
+ SODA_KEY_ENCODING=binary
306
+ SODA_DATA_ENCODING=binary
307
+ SODA_COMPRESSION=brotli
308
+ SODA_KDF_PROFILE=sensitive
309
+ SODA_GROUP_LEN=0
310
+ SODA_LINE_LEN=0
311
+ SODA_PADDING=0
312
+ SODA_VERBOSE=0
313
+ ```
314
+
315
+
316
+ ## Alternative usage
317
+
318
+ - Password source
319
+ ```
320
+ % echo "A line from a book or a poem" | soda kdf - -e base94 -p interactive
321
+ <frozen importlib._bootstrap>:491: RuntimeWarning: The global interpreter lock (GIL) has been enabled to load module '_brotli', which has not declared that it can run safely without the GIL. To override this behavior and keep the GIL disabled (at your own risk), run with PYTHON_GIL=0 or -Xgil=0.
322
+ x\R9"~8Ujh^_uh:Ty<!t(ZNzK=5w^ukew~#-x!n
323
+ ```
324
+
325
+ - WireGuard keyer
326
+ ```
327
+ % echo "A line from a book or a poem" | soda kdf - -p interactive -o privkey
328
+ % cat privkey
329
+ uIoBJdgaz8ZP3/n/9KzdUNvFi7DxbUQdQ9t8ujwGnMk=
330
+ % soda pubkey privkey
331
+ <frozen importlib._bootstrap>:491: RuntimeWarning: The global interpreter lock (GIL) has been enabled to load module '_brotli', which has not declared that it can run safely without the GIL. To override this behavior and keep the GIL disabled (at your own risk), run with PYTHON_GIL=0 or -Xgil=0.
332
+ F2B674kXVcTznnRPWCVasx1miCT+yUtXQ3P5Ecee4zI=
333
+ % cat privkey | wg pubkey
334
+ F2B674kXVcTznnRPWCVasx1miCT+yUtXQ3P5Ecee4zI=
335
+ ```
336
+
337
+
338
+ ## Compatibility
339
+
340
+ During the initial development (versions prior to 1.0.0),
341
+ I can break backwards compatibility.
342
+
343
+
344
+ ## Releases
345
+
346
+ This project follows a rolling release cycle.
347
+ Each version bump represents where I completed a full test cycle.
348
+ When testing passes successfully, I commit and release - so every release is a verified stable point.
@@ -0,0 +1,322 @@
1
+ # rtty-soda
2
+
3
+ A CLI tool for Unix-like environments to encrypt a RTTY session using NaCl.
4
+
5
+
6
+ #### Features
7
+
8
+ - Public Key encryption (Curve25519-XSalsa20-Poly1305)
9
+ - Secret Key encryption (XSalsa20-Poly1305)
10
+ - Key derivation (Argon2id-Blake2b)
11
+ - Text compression (brotli, zstd, zlib, bz2, lzma)
12
+ - Custom encodings:
13
+ - Base10 (Decimal)
14
+ - Base26 (Latin)
15
+ - Base31 (Cyrillic)
16
+ - Base36 (Latin with numbers)
17
+ - Base64 (RFC 4648)
18
+ - Base94 (ASCII printable)
19
+ - Binary
20
+
21
+
22
+ ## Installation
23
+ #### Package manager
24
+
25
+ 1. [Install uv](https://docs.astral.sh/uv/getting-started/installation/)
26
+ 2. Install rtty-soda:
27
+ ```
28
+ % uv tool install "rtty-soda[cli]"
29
+ ```
30
+ 3. Remove rtty-soda:
31
+ ```
32
+ % uv tool uninstall rtty-soda
33
+ ```
34
+
35
+ #### Docker
36
+
37
+ ```
38
+ % docker run -it --rm -h rtty-soda -v .:/app/host nett/rtty-soda:0.3.11
39
+ % docker run -it --rm -h rtty-soda -v .:/app/host nett/rtty-soda:0.3.11-tools
40
+ ```
41
+
42
+
43
+ ## Getting help
44
+
45
+ All commands have `[-h | --help]` option.
46
+
47
+ ```
48
+ % soda
49
+ <frozen importlib._bootstrap>:491: RuntimeWarning: The global interpreter lock (GIL) has been enabled to load module '_brotli', which has not declared that it can run safely without the GIL. To override this behavior and keep the GIL disabled (at your own risk), run with PYTHON_GIL=0 or -Xgil=0.
50
+ Usage: soda [OPTIONS] COMMAND [ARGS]...
51
+
52
+ Options:
53
+ --version Show the version and exit.
54
+ -h, --help Show this message and exit.
55
+
56
+ Commands:
57
+ decrypt-password (dp) Decrypt Message (Password).
58
+ decrypt-public (d) Decrypt Message (Public).
59
+ decrypt-secret (ds) Decrypt Message (Secret).
60
+ encode Encode File.
61
+ encrypt-password (ep) Encrypt Message (Password).
62
+ encrypt-public (e) Encrypt Message (Public).
63
+ encrypt-secret (es) Encrypt Message (Secret).
64
+ genkey Generate Private Key.
65
+ kdf Key Derivation Function.
66
+ pubkey Get Public Key.
67
+ ```
68
+
69
+ Some commands have aliases, so `% soda encrypt-password ...` and `% soda ep ...`
70
+ are equivalent.
71
+
72
+
73
+ ## Public Key encryption
74
+ #### Key generation
75
+
76
+ ```
77
+ % soda genkey | tee alice | soda pubkey - | tee alice_pub
78
+ <frozen importlib._bootstrap>:491: RuntimeWarning: The global interpreter lock (GIL) has been enabled to load module '_brotli', which has not declared that it can run safely without the GIL. To override this behavior and keep the GIL disabled (at your own risk), run with PYTHON_GIL=0 or -Xgil=0.
79
+ <frozen importlib._bootstrap>:491: RuntimeWarning: The global interpreter lock (GIL) has been enabled to load module '_brotli', which has not declared that it can run safely without the GIL. To override this behavior and keep the GIL disabled (at your own risk), run with PYTHON_GIL=0 or -Xgil=0.
80
+ HT6UNhua+slsp+GBWyIiLjw55iWGOSvgdHtOaidbQSc=
81
+
82
+ % soda genkey | tee bob | soda pubkey - | tee bob_pub
83
+ <frozen importlib._bootstrap>:491: RuntimeWarning: The global interpreter lock (GIL) has been enabled to load module '_brotli', which has not declared that it can run safely without the GIL. To override this behavior and keep the GIL disabled (at your own risk), run with PYTHON_GIL=0 or -Xgil=0.
84
+ <frozen importlib._bootstrap>:491: RuntimeWarning: The global interpreter lock (GIL) has been enabled to load module '_brotli', which has not declared that it can run safely without the GIL. To override this behavior and keep the GIL disabled (at your own risk), run with PYTHON_GIL=0 or -Xgil=0.
85
+ 8+tcGctkBSSCsWv6oGduS5/DcCdKx4A6GOiEfBiyBWE=
86
+
87
+ % soda genkey -h
88
+ <frozen importlib._bootstrap>:491: RuntimeWarning: The global interpreter lock (GIL) has been enabled to load module '_brotli', which has not declared that it can run safely without the GIL. To override this behavior and keep the GIL disabled (at your own risk), run with PYTHON_GIL=0 or -Xgil=0.
89
+ Usage: soda genkey [OPTIONS]
90
+
91
+ Generate Private Key.
92
+
93
+ Encoding: base10 | base26 | base31 | base36 | base64 | base94 | binary
94
+
95
+ Options:
96
+ -e, --encoding TEXT [default: base64]
97
+ -o, --output-file FILE Write output to file.
98
+ -g, --group-len INTEGER [default: 0]
99
+ --line-len INTEGER [default: 80]
100
+ --padding INTEGER [default: 0]
101
+ -v, --verbose Show verbose output.
102
+ -h, --help Show this message and exit.
103
+ ```
104
+
105
+ #### Encryption
106
+
107
+ Alice sends the message to Bob:
108
+
109
+ ```
110
+ % cat message
111
+ A telegraph key is a specialized electrical switch used by a trained operator to
112
+ transmit text messages in Morse code in a telegraphy system.
113
+ The first telegraph key was invented by Alfred Vail, an associate of Samuel Morse.
114
+ (c) Wikipedia
115
+
116
+ % soda encrypt-public alice bob_pub message | tee encrypted | cut -c 1-80
117
+ <frozen importlib._bootstrap>:491: RuntimeWarning: The global interpreter lock (GIL) has been enabled to load module '_brotli', which has not declared that it can run safely without the GIL. To override this behavior and keep the GIL disabled (at your own risk), run with PYTHON_GIL=0 or -Xgil=0.
118
+ lbu7UO4XgNUJcYKfX0IonastYWzwhL1h8OnW4Ks2nyTCwAsJK78NSa/iUqjmjGN9PlwXiDakvJHFigZD
119
+
120
+ % soda encrypt-public -h
121
+ <frozen importlib._bootstrap>:491: RuntimeWarning: The global interpreter lock (GIL) has been enabled to load module '_brotli', which has not declared that it can run safely without the GIL. To override this behavior and keep the GIL disabled (at your own risk), run with PYTHON_GIL=0 or -Xgil=0.
122
+ Usage: soda encrypt-public [OPTIONS] PRIVATE_KEY_FILE PUBLIC_KEY_FILE
123
+ MESSAGE_FILE
124
+
125
+ Encrypt Message (Public).
126
+
127
+ Encoding: base10 | base26 | base31 | base36 | base64 | base94 | binary
128
+
129
+ Compression: brotli | zstd | zlib | bz2 | lzma | raw
130
+
131
+ Options:
132
+ -t, --text Treat message as text (binary if not specified).
133
+ --key-encoding TEXT [default: base64]
134
+ -e, --data-encoding TEXT [default: base64]
135
+ -c, --compression TEXT [default: brotli]
136
+ -o, --output-file FILE Write output to file.
137
+ -g, --group-len INTEGER [default: 0]
138
+ --line-len INTEGER [default: 80]
139
+ --padding INTEGER [default: 0]
140
+ -v, --verbose Show verbose output.
141
+ -h, --help Show this message and exit.
142
+ ```
143
+
144
+ #### Decryption
145
+
146
+ ```
147
+ % soda decrypt-public bob alice_pub encrypted
148
+ <frozen importlib._bootstrap>:491: RuntimeWarning: The global interpreter lock (GIL) has been enabled to load module '_brotli', which has not declared that it can run safely without the GIL. To override this behavior and keep the GIL disabled (at your own risk), run with PYTHON_GIL=0 or -Xgil=0.
149
+ A telegraph key is a specialized electrical switch used by a trained operator to
150
+ transmit text messages in Morse code in a telegraphy system.
151
+ The first telegraph key was invented by Alfred Vail, an associate of Samuel Morse.
152
+ (c) Wikipedia
153
+ ```
154
+
155
+
156
+ ## Secret Key encryption
157
+
158
+ Alice and Bob share a key for symmetric encryption:
159
+
160
+ ```
161
+ % soda genkey > shared
162
+ <frozen importlib._bootstrap>:491: RuntimeWarning: The global interpreter lock (GIL) has been enabled to load module '_brotli', which has not declared that it can run safely without the GIL. To override this behavior and keep the GIL disabled (at your own risk), run with PYTHON_GIL=0 or -Xgil=0.% soda encrypt-secret shared message -o encrypted
163
+ % soda decrypt-secret shared encrypted -o message
164
+ ```
165
+
166
+ Another day, they share a password:
167
+
168
+ ```
169
+ % echo qwerty | soda encrypt-password - message -p interactive -o encrypted
170
+ % echo qwerty | soda decrypt-password - encrypted -p interactive -o message
171
+ ```
172
+
173
+
174
+ ## Key derivation
175
+
176
+ The KDF function derives the key from the password.
177
+ It accepts different profiles: interactive, moderate, and sensitive.
178
+
179
+ ```
180
+ % echo qwerty | soda kdf - -p interactive
181
+ <frozen importlib._bootstrap>:491: RuntimeWarning: The global interpreter lock (GIL) has been enabled to load module '_brotli', which has not declared that it can run safely without the GIL. To override this behavior and keep the GIL disabled (at your own risk), run with PYTHON_GIL=0 or -Xgil=0.
182
+ HqbvUXflAG+no3YS9njezZ3leyr8IwERAyeNoG2l41U=
183
+
184
+ % soda kdf -h
185
+ <frozen importlib._bootstrap>:491: RuntimeWarning: The global interpreter lock (GIL) has been enabled to load module '_brotli', which has not declared that it can run safely without the GIL. To override this behavior and keep the GIL disabled (at your own risk), run with PYTHON_GIL=0 or -Xgil=0.
186
+ Usage: soda kdf [OPTIONS] PASSWORD_FILE
187
+
188
+ Key Derivation Function.
189
+
190
+ Encoding: base10 | base26 | base31 | base36 | base64 | base94 | binary
191
+
192
+ Profile: interactive | moderate | sensitive
193
+
194
+ Options:
195
+ -e, --encoding TEXT [default: base64]
196
+ -p, --profile TEXT [default: sensitive]
197
+ -o, --output-file FILE Write output to file.
198
+ -g, --group-len INTEGER [default: 0]
199
+ --line-len INTEGER [default: 80]
200
+ --padding INTEGER [default: 0]
201
+ -v, --verbose Show verbose output.
202
+ -h, --help Show this message and exit.
203
+ ```
204
+
205
+ ![KDF diagram](https://github.com/theosaveliev/rtty-soda/raw/main/diagram/kdf.png)
206
+
207
+
208
+ ## Text compression
209
+
210
+ That works as follows:
211
+ 1. The plaintext is prepared:
212
+ - In binary mode (default), the message is read as bytes
213
+ - In text mode (`-t, --text`), the message is read as a string, stripped, and encoded with SCSU, reducing the size of Unicode messages by 15–50%
214
+ 2. The plaintext is compressed with the compression lib
215
+ 3. The 16-byte MAC and 24-byte nonce are added
216
+ 4. The result is encoded with Base64, which adds ~33% overhead
217
+
218
+ ```
219
+ % soda es shared message -t -v -c brotli > /dev/null
220
+ <frozen importlib._bootstrap>:491: RuntimeWarning: The global interpreter lock (GIL) has been enabled to load module '_brotli', which has not declared that it can run safely without the GIL. To override this behavior and keep the GIL disabled (at your own risk), run with PYTHON_GIL=0 or -Xgil=0.
221
+ Plaintext: 238
222
+ Ciphertext: 216
223
+ Overhead: 0.908
224
+ Groups: 1
225
+ % soda es shared message -t -v -c zstd > /dev/null
226
+ <frozen importlib._bootstrap>:491: RuntimeWarning: The global interpreter lock (GIL) has been enabled to load module '_brotli', which has not declared that it can run safely without the GIL. To override this behavior and keep the GIL disabled (at your own risk), run with PYTHON_GIL=0 or -Xgil=0.
227
+ Plaintext: 238
228
+ Ciphertext: 276
229
+ Overhead: 1.160
230
+ Groups: 1
231
+ % soda es shared message -t -v -c zlib > /dev/null
232
+ <frozen importlib._bootstrap>:491: RuntimeWarning: The global interpreter lock (GIL) has been enabled to load module '_brotli', which has not declared that it can run safely without the GIL. To override this behavior and keep the GIL disabled (at your own risk), run with PYTHON_GIL=0 or -Xgil=0.
233
+ Plaintext: 238
234
+ Ciphertext: 280
235
+ Overhead: 1.176
236
+ Groups: 1
237
+ % soda es shared message -t -v -c bz2 > /dev/null
238
+ <frozen importlib._bootstrap>:491: RuntimeWarning: The global interpreter lock (GIL) has been enabled to load module '_brotli', which has not declared that it can run safely without the GIL. To override this behavior and keep the GIL disabled (at your own risk), run with PYTHON_GIL=0 or -Xgil=0.
239
+ Plaintext: 238
240
+ Ciphertext: 336
241
+ Overhead: 1.412
242
+ Groups: 1
243
+ % soda es shared message -t -v -c lzma > /dev/null
244
+ <frozen importlib._bootstrap>:491: RuntimeWarning: The global interpreter lock (GIL) has been enabled to load module '_brotli', which has not declared that it can run safely without the GIL. To override this behavior and keep the GIL disabled (at your own risk), run with PYTHON_GIL=0 or -Xgil=0.
245
+ Plaintext: 238
246
+ Ciphertext: 320
247
+ Overhead: 1.345
248
+ Groups: 1
249
+ % soda es shared message -t -v -c raw > /dev/null
250
+ <frozen importlib._bootstrap>:491: RuntimeWarning: The global interpreter lock (GIL) has been enabled to load module '_brotli', which has not declared that it can run safely without the GIL. To override this behavior and keep the GIL disabled (at your own risk), run with PYTHON_GIL=0 or -Xgil=0.
251
+ Plaintext: 238
252
+ Ciphertext: 372
253
+ Overhead: 1.563
254
+ Groups: 1
255
+ ```
256
+
257
+
258
+ ## Encoding
259
+
260
+ The rtty-soda supports various encodings:
261
+
262
+ ```
263
+ % soda encrypt-public alice bob_pub message --data-encoding base36 --group-len 5 --text
264
+ <frozen importlib._bootstrap>:491: RuntimeWarning: The global interpreter lock (GIL) has been enabled to load module '_brotli', which has not declared that it can run safely without the GIL. To override this behavior and keep the GIL disabled (at your own risk), run with PYTHON_GIL=0 or -Xgil=0.
265
+ 513S7 9BLUG AVKLP S8PV8 GGOAJ I4ZG2 W0CLI O2H8J P270K Z36S0 17ZSN 4VJVR 0L2GL
266
+ QD3S3 K9LYV K1NTU 0QYYD IL032 60P67 U0NNO UY7S2 WO55O 6CNHV OMUEM IDFQ5 PIAIU
267
+ OHX15 1OM4H 4T1IR SAH2U V87ZS SC2TB IFE8X 3YB0H YUL2C LXQLW 37PJZ IJ50M JJH0X
268
+ VX8IM MQ4ON 9DRX2 RGX2J WXW1P RYHP9 G3AJ9 6PJOC DPREK 6ND5Q RHV
269
+ ```
270
+
271
+
272
+ ## Environment variables
273
+
274
+ Common options can be set in the environment variables:
275
+
276
+ ```
277
+ % cat ~/.soda/bin.env
278
+ SODA_TEXT=0
279
+ SODA_KEY_ENCODING=binary
280
+ SODA_DATA_ENCODING=binary
281
+ SODA_COMPRESSION=brotli
282
+ SODA_KDF_PROFILE=sensitive
283
+ SODA_GROUP_LEN=0
284
+ SODA_LINE_LEN=0
285
+ SODA_PADDING=0
286
+ SODA_VERBOSE=0
287
+ ```
288
+
289
+
290
+ ## Alternative usage
291
+
292
+ - Password source
293
+ ```
294
+ % echo "A line from a book or a poem" | soda kdf - -e base94 -p interactive
295
+ <frozen importlib._bootstrap>:491: RuntimeWarning: The global interpreter lock (GIL) has been enabled to load module '_brotli', which has not declared that it can run safely without the GIL. To override this behavior and keep the GIL disabled (at your own risk), run with PYTHON_GIL=0 or -Xgil=0.
296
+ x\R9"~8Ujh^_uh:Ty<!t(ZNzK=5w^ukew~#-x!n
297
+ ```
298
+
299
+ - WireGuard keyer
300
+ ```
301
+ % echo "A line from a book or a poem" | soda kdf - -p interactive -o privkey
302
+ % cat privkey
303
+ uIoBJdgaz8ZP3/n/9KzdUNvFi7DxbUQdQ9t8ujwGnMk=
304
+ % soda pubkey privkey
305
+ <frozen importlib._bootstrap>:491: RuntimeWarning: The global interpreter lock (GIL) has been enabled to load module '_brotli', which has not declared that it can run safely without the GIL. To override this behavior and keep the GIL disabled (at your own risk), run with PYTHON_GIL=0 or -Xgil=0.
306
+ F2B674kXVcTznnRPWCVasx1miCT+yUtXQ3P5Ecee4zI=
307
+ % cat privkey | wg pubkey
308
+ F2B674kXVcTznnRPWCVasx1miCT+yUtXQ3P5Ecee4zI=
309
+ ```
310
+
311
+
312
+ ## Compatibility
313
+
314
+ During the initial development (versions prior to 1.0.0),
315
+ I can break backwards compatibility.
316
+
317
+
318
+ ## Releases
319
+
320
+ This project follows a rolling release cycle.
321
+ Each version bump represents where I completed a full test cycle.
322
+ When testing passes successfully, I commit and release - so every release is a verified stable point.