transcrypto 2.0.0__py3-none-any.whl → 2.0.3__py3-none-any.whl

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.
transcrypto/__init__.py CHANGED
@@ -3,5 +3,5 @@
3
3
  """Basic cryptography primitives implementation."""
4
4
 
5
5
  __all__: list[str] = ['__author__', '__version__']
6
- __version__ = '2.0.0' # remember to also update pyproject.toml
6
+ __version__ = '2.0.3' # remember to also update pyproject.toml
7
7
  __author__ = 'Daniel Balparda <balparda@github.com>'
@@ -41,7 +41,7 @@ transcrypto.app.add_typer(hash_app, name='hash')
41
41
  @clibase.CLIErrorGuard
42
42
  def Hash256( # documentation is help/epilog/args # noqa: D103
43
43
  *,
44
- ctx: typer.Context,
44
+ ctx: click.Context,
45
45
  data: str = typer.Argument(..., help='Input data (raw text; or `--input-format <hex|b64|bin>`)'),
46
46
  ) -> None:
47
47
  config: transcrypto.TransConfig = ctx.obj
@@ -65,7 +65,7 @@ def Hash256( # documentation is help/epilog/args # noqa: D103
65
65
  @clibase.CLIErrorGuard
66
66
  def Hash512( # documentation is help/epilog/args # noqa: D103
67
67
  *,
68
- ctx: typer.Context,
68
+ ctx: click.Context,
69
69
  data: str = typer.Argument(..., help='Input data (raw text; or `--input-format <hex|b64|bin>`)'),
70
70
  ) -> None:
71
71
  config: transcrypto.TransConfig = ctx.obj
@@ -86,7 +86,7 @@ def Hash512( # documentation is help/epilog/args # noqa: D103
86
86
  @clibase.CLIErrorGuard
87
87
  def HashFile( # documentation is help/epilog/args # noqa: D103
88
88
  *,
89
- ctx: typer.Context,
89
+ ctx: click.Context,
90
90
  path: pathlib.Path = typer.Argument( # noqa: B008
91
91
  ...,
92
92
  exists=True,
@@ -142,7 +142,7 @@ transcrypto.app.add_typer(aes_app, name='aes')
142
142
  @clibase.CLIErrorGuard
143
143
  def AESKeyFromPass( # documentation is help/epilog/args # noqa: D103
144
144
  *,
145
- ctx: typer.Context,
145
+ ctx: click.Context,
146
146
  password: str = typer.Argument(..., help='Password (leading/trailing spaces ignored)'),
147
147
  ) -> None:
148
148
  config: transcrypto.TransConfig = ctx.obj
@@ -176,7 +176,7 @@ def AESKeyFromPass( # documentation is help/epilog/args # noqa: D103
176
176
  @clibase.CLIErrorGuard
177
177
  def AESEncrypt( # documentation is help/epilog/args # noqa: D103
178
178
  *,
179
- ctx: typer.Context,
179
+ ctx: click.Context,
180
180
  plaintext: str = typer.Argument(..., help='Input data to encrypt (PT)'),
181
181
  key: str | None = typer.Option(
182
182
  None, '-k', '--key', help="Key if `-p`/`--key-path` wasn't used (32 bytes)"
@@ -228,7 +228,7 @@ def AESEncrypt( # documentation is help/epilog/args # noqa: D103
228
228
  @clibase.CLIErrorGuard
229
229
  def AESDecrypt( # documentation is help/epilog/args # noqa: D103
230
230
  *,
231
- ctx: typer.Context,
231
+ ctx: click.Context,
232
232
  ciphertext: str = typer.Argument(..., help='Input data to decrypt (CT)'),
233
233
  key: str | None = typer.Option(
234
234
  None, '-k', '--key', help="Key if `-p`/`--key-path` wasn't used (32 bytes)"
@@ -289,7 +289,7 @@ aes_app.add_typer(aes_ecb_app, name='ecb')
289
289
  @clibase.CLIErrorGuard
290
290
  def AESECBEncrypt( # documentation is help/epilog/args # noqa: D103
291
291
  *,
292
- ctx: typer.Context,
292
+ ctx: click.Context,
293
293
  plaintext: str = typer.Argument(..., help='Plaintext block as 32 hex chars (16-bytes)'),
294
294
  key: str | None = typer.Option(
295
295
  None,
@@ -338,7 +338,7 @@ def AESECBEncrypt( # documentation is help/epilog/args # noqa: D103
338
338
  @clibase.CLIErrorGuard
339
339
  def AESECBDecrypt( # documentation is help/epilog/args # noqa: D103
340
340
  *,
341
- ctx: typer.Context,
341
+ ctx: click.Context,
342
342
  ciphertext: str = typer.Argument(..., help='Ciphertext block as 32 hex chars (16-bytes)'),
343
343
  key: str | None = typer.Option(
344
344
  None,
@@ -6,6 +6,7 @@ from __future__ import annotations
6
6
 
7
7
  import glob
8
8
 
9
+ import click
9
10
  import typer
10
11
 
11
12
  from transcrypto import transcrypto
@@ -41,7 +42,7 @@ transcrypto.app.add_typer(bid_app, name='bid')
41
42
  @clibase.CLIErrorGuard
42
43
  def BidNew( # documentation is help/epilog/args # noqa: D103
43
44
  *,
44
- ctx: typer.Context,
45
+ ctx: click.Context,
45
46
  secret: str = typer.Argument(..., help='Input data to bid to, the protected "secret"'),
46
47
  ) -> None:
47
48
  config: transcrypto.TransConfig = ctx.obj
@@ -66,7 +67,7 @@ def BidNew( # documentation is help/epilog/args # noqa: D103
66
67
  ),
67
68
  )
68
69
  @clibase.CLIErrorGuard
69
- def BidVerify(*, ctx: typer.Context) -> None: # documentation is help/epilog/args # noqa: D103
70
+ def BidVerify(*, ctx: click.Context) -> None: # documentation is help/epilog/args # noqa: D103
70
71
  config: transcrypto.TransConfig = ctx.obj
71
72
  base_path: str = transcrypto.RequireKeyPath(config, 'bid')
72
73
  bid_priv: bid.PrivateBid512 = transcrypto.LoadObj(
@@ -122,7 +123,7 @@ transcrypto.app.add_typer(sss_app, name='sss')
122
123
  @clibase.CLIErrorGuard
123
124
  def SSSNew( # documentation is help/epilog/args # noqa: D103
124
125
  *,
125
- ctx: typer.Context,
126
+ ctx: click.Context,
126
127
  minimum: int = typer.Argument(
127
128
  ..., min=2, help='Minimum number of shares required to recover secret, ≥ 2'
128
129
  ),
@@ -163,7 +164,7 @@ def SSSNew( # documentation is help/epilog/args # noqa: D103
163
164
  @clibase.CLIErrorGuard
164
165
  def SSSRawShares( # documentation is help/epilog/args # noqa: D103
165
166
  *,
166
- ctx: typer.Context,
167
+ ctx: click.Context,
167
168
  secret: str = typer.Argument(..., help='Integer secret to be protected, 1≤`secret`<*modulus*'),
168
169
  count: int = typer.Argument(
169
170
  ...,
@@ -208,7 +209,7 @@ def SSSRawShares( # documentation is help/epilog/args # noqa: D103
208
209
  ),
209
210
  )
210
211
  @clibase.CLIErrorGuard
211
- def SSSRawRecover(*, ctx: typer.Context) -> None: # documentation is help/epilog/args # noqa: D103
212
+ def SSSRawRecover(*, ctx: click.Context) -> None: # documentation is help/epilog/args # noqa: D103
212
213
  config: transcrypto.TransConfig = ctx.obj
213
214
  base_path: str = transcrypto.RequireKeyPath(config, 'sss')
214
215
  sss_pub: sss.ShamirSharedSecretPublic = transcrypto.LoadObj(
@@ -243,7 +244,7 @@ def SSSRawRecover(*, ctx: typer.Context) -> None: # documentation is help/epilo
243
244
  @clibase.CLIErrorGuard
244
245
  def SSSRawVerify( # documentation is help/epilog/args # noqa: D103
245
246
  *,
246
- ctx: typer.Context,
247
+ ctx: click.Context,
247
248
  secret: str = typer.Argument(..., help='Integer secret used to generate the shares, ≥ 1'),
248
249
  ) -> None:
249
250
  config: transcrypto.TransConfig = ctx.obj
@@ -275,7 +276,7 @@ def SSSRawVerify( # documentation is help/epilog/args # noqa: D103
275
276
  @clibase.CLIErrorGuard
276
277
  def SSSShares( # documentation is help/epilog/args # noqa: D103
277
278
  *,
278
- ctx: typer.Context,
279
+ ctx: click.Context,
279
280
  secret: str = typer.Argument(..., help='Secret to be protected'),
280
281
  count: int = typer.Argument(
281
282
  ...,
@@ -316,7 +317,7 @@ def SSSShares( # documentation is help/epilog/args # noqa: D103
316
317
  ),
317
318
  )
318
319
  @clibase.CLIErrorGuard
319
- def SSSRecover(*, ctx: typer.Context) -> None: # documentation is help/epilog/args # noqa: D103
320
+ def SSSRecover(*, ctx: click.Context) -> None: # documentation is help/epilog/args # noqa: D103
320
321
  config: transcrypto.TransConfig = ctx.obj
321
322
  base_path: str = transcrypto.RequireKeyPath(config, 'sss')
322
323
  subset: list[sss.ShamirSharePrivate] = []
@@ -51,10 +51,10 @@ def CLIErrorGuard[**P](fn: abc.Callable[P, None], /) -> abc.Callable[P, None]:
51
51
  except (base.Error, ValueError) as err:
52
52
  # get context
53
53
  ctx: object | None = dict(kwargs).get('ctx')
54
- if not isinstance(ctx, typer.Context):
55
- ctx = next((a for a in args if isinstance(a, typer.Context)), None)
54
+ if not isinstance(ctx, click.Context):
55
+ ctx = next((a for a in args if isinstance(a, click.Context)), None)
56
56
  # print error nicely
57
- if isinstance(ctx, typer.Context):
57
+ if isinstance(ctx, click.Context):
58
58
  # we have context
59
59
  obj: CLIConfig = cast('CLIConfig', ctx.obj)
60
60
  if obj.verbose >= 2: # verbose >= 2 means INFO level or more verbose # noqa: PLR2004
@@ -72,20 +72,20 @@ def CLIErrorGuard[**P](fn: abc.Callable[P, None], /) -> abc.Callable[P, None]:
72
72
 
73
73
  def _ClickWalk(
74
74
  command: click.Command,
75
- ctx: typer.Context,
75
+ ctx: click.Context,
76
76
  path: list[str],
77
77
  /,
78
- ) -> abc.Iterator[tuple[list[str], click.Command, typer.Context]]:
78
+ ) -> abc.Iterator[tuple[list[str], click.Command, click.Context]]:
79
79
  """Recursively walk Click commands/groups.
80
80
 
81
81
  Yields:
82
- tuple[list[str], click.Command, typer.Context]: path, command, ctx
82
+ tuple[list[str], click.Command, click.Context]: path, command, ctx
83
83
 
84
84
  """
85
85
  yield (path, command, ctx) # yield self
86
86
  # now walk subcommands, if any
87
87
  sub_cmd: click.Command | None
88
- sub_ctx: typer.Context
88
+ sub_ctx: click.Context
89
89
  # prefer the explicit `.commands` mapping when present; otherwise fall back to
90
90
  # click's `list_commands()`/`get_command()` for dynamic groups
91
91
  if not isinstance(command, click.Group):
@@ -93,7 +93,7 @@ def _ClickWalk(
93
93
  # explicit commands mapping
94
94
  if command.commands:
95
95
  for name, sub_cmd in sorted(command.commands.items()):
96
- sub_ctx = typer.Context(sub_cmd, info_name=name, parent=ctx)
96
+ sub_ctx = click.Context(sub_cmd, info_name=name, parent=ctx)
97
97
  yield from _ClickWalk(sub_cmd, sub_ctx, [*path, name])
98
98
  return
99
99
  # dynamic commands
@@ -101,7 +101,7 @@ def _ClickWalk(
101
101
  sub_cmd = command.get_command(ctx, name)
102
102
  if sub_cmd is None:
103
103
  continue # skip invalid subcommands
104
- sub_ctx = typer.Context(sub_cmd, info_name=name, parent=ctx)
104
+ sub_ctx = click.Context(sub_cmd, info_name=name, parent=ctx)
105
105
  yield from _ClickWalk(sub_cmd, sub_ctx, [*path, name])
106
106
 
107
107
 
@@ -140,7 +140,7 @@ def GenerateTyperHelpMarkdown(
140
140
  """
141
141
  # prepare Click root command and context
142
142
  click_root: click.Command = typer.main.get_command(typer_app)
143
- root_ctx: typer.Context = typer.Context(click_root, info_name=prog_name)
143
+ root_ctx: click.Context = click.Context(click_root, info_name=prog_name)
144
144
  runner = click_testing.CliRunner()
145
145
  parts: list[str] = []
146
146
  for path, _, _ in _ClickWalk(click_root, root_ctx, []):
@@ -4,6 +4,7 @@
4
4
 
5
5
  from __future__ import annotations
6
6
 
7
+ import click
7
8
  import typer
8
9
 
9
10
  from transcrypto import transcrypto
@@ -28,7 +29,7 @@ from transcrypto.utils import base, saferandom
28
29
  @clibase.CLIErrorGuard
29
30
  def IsPrimeCLI( # documentation is help/epilog/args # noqa: D103
30
31
  *,
31
- ctx: typer.Context,
32
+ ctx: click.Context,
32
33
  n: str = typer.Argument(..., help='Integer to test, ≥ 1'),
33
34
  ) -> None:
34
35
  config: transcrypto.TransConfig = ctx.obj
@@ -44,7 +45,7 @@ def IsPrimeCLI( # documentation is help/epilog/args # noqa: D103
44
45
  @clibase.CLIErrorGuard
45
46
  def PrimeGenCLI( # documentation is help/epilog/args # noqa: D103
46
47
  *,
47
- ctx: typer.Context,
48
+ ctx: click.Context,
48
49
  start: str = typer.Argument(..., help='Starting integer (inclusive), ≥ 0'),
49
50
  count: int = typer.Option(1, '-c', '--count', min=1, help='How many to print, ≥ 1'),
50
51
  ) -> None:
@@ -77,7 +78,7 @@ def PrimeGenCLI( # documentation is help/epilog/args # noqa: D103
77
78
  @clibase.CLIErrorGuard
78
79
  def MersenneCLI( # documentation is help/epilog/args # noqa: D103
79
80
  *,
80
- ctx: typer.Context,
81
+ ctx: click.Context,
81
82
  min_k: int = typer.Option(2, '-k', '--min-k', min=1, help='Starting exponent `k`, ≥ 2'),
82
83
  max_k: int = typer.Option(10000, '-m', '--max-k', min=1, help='Stop once `k` > `max-k`, ≥ 2'),
83
84
  ) -> None:
@@ -109,7 +110,7 @@ def MersenneCLI( # documentation is help/epilog/args # noqa: D103
109
110
  @clibase.CLIErrorGuard
110
111
  def GcdCLI( # documentation is help/epilog/args # noqa: D103
111
112
  *,
112
- ctx: typer.Context,
113
+ ctx: click.Context,
113
114
  a: str = typer.Argument(..., help='Integer, ≥ 0'),
114
115
  b: str = typer.Argument(..., help="Integer, ≥ 0 (can't be both zero)"),
115
116
  ) -> None:
@@ -140,7 +141,7 @@ def GcdCLI( # documentation is help/epilog/args # noqa: D103
140
141
  @clibase.CLIErrorGuard
141
142
  def XgcdCLI( # documentation is help/epilog/args # noqa: D103
142
143
  *,
143
- ctx: typer.Context,
144
+ ctx: click.Context,
144
145
  a: str = typer.Argument(..., help='Integer, ≥ 0'),
145
146
  b: str = typer.Argument(..., help="Integer, ≥ 0 (can't be both zero)"),
146
147
  ) -> None:
@@ -170,7 +171,7 @@ transcrypto.app.add_typer(random_app, name='random')
170
171
  @clibase.CLIErrorGuard
171
172
  def RandomBits( # documentation is help/epilog/args # noqa: D103
172
173
  *,
173
- ctx: typer.Context,
174
+ ctx: click.Context,
174
175
  bits: int = typer.Argument(..., min=8, help='Number of bits, ≥ 8'),
175
176
  ) -> None:
176
177
  config: transcrypto.TransConfig = ctx.obj
@@ -185,7 +186,7 @@ def RandomBits( # documentation is help/epilog/args # noqa: D103
185
186
  @clibase.CLIErrorGuard
186
187
  def RandomInt( # documentation is help/epilog/args # noqa: D103
187
188
  *,
188
- ctx: typer.Context,
189
+ ctx: click.Context,
189
190
  min_: str = typer.Argument(..., help='Minimum, ≥ 0'),
190
191
  max_: str = typer.Argument(..., help='Maximum, > `min`'),
191
192
  ) -> None:
@@ -207,7 +208,7 @@ def RandomInt( # documentation is help/epilog/args # noqa: D103
207
208
  @clibase.CLIErrorGuard
208
209
  def RandomBytes( # documentation is help/epilog/args # noqa: D103
209
210
  *,
210
- ctx: typer.Context,
211
+ ctx: click.Context,
211
212
  n: int = typer.Argument(..., min=1, help='Number of bytes, ≥ 1'),
212
213
  ) -> None:
213
214
  config: transcrypto.TransConfig = ctx.obj
@@ -222,7 +223,7 @@ def RandomBytes( # documentation is help/epilog/args # noqa: D103
222
223
  @clibase.CLIErrorGuard
223
224
  def RandomPrime( # documentation is help/epilog/args # noqa: D103
224
225
  *,
225
- ctx: typer.Context,
226
+ ctx: click.Context,
226
227
  bits: int = typer.Argument(..., min=11, help='Bit length, ≥ 11'),
227
228
  ) -> None:
228
229
  config: transcrypto.TransConfig = ctx.obj
@@ -258,7 +259,7 @@ transcrypto.app.add_typer(mod_app, name='mod')
258
259
  @clibase.CLIErrorGuard
259
260
  def ModInv( # documentation is help/epilog/args # noqa: D103
260
261
  *,
261
- ctx: typer.Context,
262
+ ctx: click.Context,
262
263
  a: str = typer.Argument(..., help='Integer to invert'),
263
264
  m: str = typer.Argument(..., help='Modulus `m`, ≥ 2'),
264
265
  ) -> None:
@@ -288,7 +289,7 @@ def ModInv( # documentation is help/epilog/args # noqa: D103
288
289
  @clibase.CLIErrorGuard
289
290
  def ModDiv( # documentation is help/epilog/args # noqa: D103
290
291
  *,
291
- ctx: typer.Context,
292
+ ctx: click.Context,
292
293
  x: str = typer.Argument(..., help='Integer'),
293
294
  y: str = typer.Argument(..., help='Integer, cannot be zero'),
294
295
  m: str = typer.Argument(..., help='Modulus `m`, ≥ 2'),
@@ -317,7 +318,7 @@ def ModDiv( # documentation is help/epilog/args # noqa: D103
317
318
  @clibase.CLIErrorGuard
318
319
  def ModExp( # documentation is help/epilog/args # noqa: D103
319
320
  *,
320
- ctx: typer.Context,
321
+ ctx: click.Context,
321
322
  a: str = typer.Argument(..., help='Integer value'),
322
323
  e: str = typer.Argument(..., help='Integer exponent, ≥ 0'),
323
324
  m: str = typer.Argument(..., help='Modulus `m`, ≥ 2'),
@@ -346,7 +347,7 @@ def ModExp( # documentation is help/epilog/args # noqa: D103
346
347
  @clibase.CLIErrorGuard
347
348
  def ModPoly( # documentation is help/epilog/args # noqa: D103
348
349
  *,
349
- ctx: typer.Context,
350
+ ctx: click.Context,
350
351
  x: str = typer.Argument(..., help='Evaluation point `x`'),
351
352
  m: str = typer.Argument(..., help='Modulus `m`, ≥ 2'),
352
353
  coeff: list[str] = typer.Argument( # noqa: B008
@@ -378,7 +379,7 @@ def ModPoly( # documentation is help/epilog/args # noqa: D103
378
379
  @clibase.CLIErrorGuard
379
380
  def ModLagrange( # documentation is help/epilog/args # noqa: D103
380
381
  *,
381
- ctx: typer.Context,
382
+ ctx: click.Context,
382
383
  x: str = typer.Argument(..., help='Evaluation point `x`'),
383
384
  m: str = typer.Argument(..., help='Modulus `m`, ≥ 2'),
384
385
  pt: list[str] = typer.Argument( # noqa: B008
@@ -412,7 +413,7 @@ def ModLagrange( # documentation is help/epilog/args # noqa: D103
412
413
  @clibase.CLIErrorGuard
413
414
  def ModCRT( # documentation is help/epilog/args # noqa: D103
414
415
  *,
415
- ctx: typer.Context,
416
+ ctx: click.Context,
416
417
  a1: str = typer.Argument(..., help='Integer residue for first congruence'),
417
418
  m1: str = typer.Argument(..., help='Modulus `m1`, ≥ 2'),
418
419
  a2: str = typer.Argument(..., help='Integer residue for second congruence'),
@@ -4,6 +4,7 @@
4
4
 
5
5
  from __future__ import annotations
6
6
 
7
+ import click
7
8
  import typer
8
9
 
9
10
  from transcrypto import transcrypto
@@ -43,7 +44,7 @@ transcrypto.app.add_typer(rsa_app, name='rsa')
43
44
  @clibase.CLIErrorGuard
44
45
  def RSANew( # documentation is help/epilog/args # noqa: D103
45
46
  *,
46
- ctx: typer.Context,
47
+ ctx: click.Context,
47
48
  bits: int = typer.Option(
48
49
  3332,
49
50
  '-b',
@@ -75,7 +76,7 @@ def RSANew( # documentation is help/epilog/args # noqa: D103
75
76
  @clibase.CLIErrorGuard
76
77
  def RSARawEncrypt( # documentation is help/epilog/args # noqa: D103
77
78
  *,
78
- ctx: typer.Context,
79
+ ctx: click.Context,
79
80
  message: str = typer.Argument(..., help='Integer message to encrypt, 1≤`message`<*modulus*'),
80
81
  ) -> None:
81
82
  config: transcrypto.TransConfig = ctx.obj
@@ -102,7 +103,7 @@ def RSARawEncrypt( # documentation is help/epilog/args # noqa: D103
102
103
  @clibase.CLIErrorGuard
103
104
  def RSARawDecrypt( # documentation is help/epilog/args # noqa: D103
104
105
  *,
105
- ctx: typer.Context,
106
+ ctx: click.Context,
106
107
  ciphertext: str = typer.Argument(
107
108
  ..., help='Integer ciphertext to decrypt, 1≤`ciphertext`<*modulus*'
108
109
  ),
@@ -126,7 +127,7 @@ def RSARawDecrypt( # documentation is help/epilog/args # noqa: D103
126
127
  @clibase.CLIErrorGuard
127
128
  def RSARawSign( # documentation is help/epilog/args # noqa: D103
128
129
  *,
129
- ctx: typer.Context,
130
+ ctx: click.Context,
130
131
  message: str = typer.Argument(..., help='Integer message to sign, 1≤`message`<*modulus*'),
131
132
  ) -> None:
132
133
  config: transcrypto.TransConfig = ctx.obj
@@ -153,7 +154,7 @@ def RSARawSign( # documentation is help/epilog/args # noqa: D103
153
154
  @clibase.CLIErrorGuard
154
155
  def RSARawVerify( # documentation is help/epilog/args # noqa: D103
155
156
  *,
156
- ctx: typer.Context,
157
+ ctx: click.Context,
157
158
  message: str = typer.Argument(
158
159
  ..., help='Integer message that was signed earlier, 1≤`message`<*modulus*'
159
160
  ),
@@ -186,7 +187,7 @@ def RSARawVerify( # documentation is help/epilog/args # noqa: D103
186
187
  @clibase.CLIErrorGuard
187
188
  def RSAEncrypt( # documentation is help/epilog/args # noqa: D103
188
189
  *,
189
- ctx: typer.Context,
190
+ ctx: click.Context,
190
191
  plaintext: str = typer.Argument(..., help='Message to encrypt'),
191
192
  aad: str = typer.Option(
192
193
  '',
@@ -217,7 +218,7 @@ def RSAEncrypt( # documentation is help/epilog/args # noqa: D103
217
218
  @clibase.CLIErrorGuard
218
219
  def RSADecrypt( # documentation is help/epilog/args # noqa: D103
219
220
  *,
220
- ctx: typer.Context,
221
+ ctx: click.Context,
221
222
  ciphertext: str = typer.Argument(..., help='Ciphertext to decrypt'),
222
223
  aad: str = typer.Option(
223
224
  '',
@@ -247,7 +248,7 @@ def RSADecrypt( # documentation is help/epilog/args # noqa: D103
247
248
  @clibase.CLIErrorGuard
248
249
  def RSASign( # documentation is help/epilog/args # noqa: D103
249
250
  *,
250
- ctx: typer.Context,
251
+ ctx: click.Context,
251
252
  message: str = typer.Argument(..., help='Message to sign'),
252
253
  aad: str = typer.Option(
253
254
  '',
@@ -281,7 +282,7 @@ def RSASign( # documentation is help/epilog/args # noqa: D103
281
282
  @clibase.CLIErrorGuard
282
283
  def RSAVerify( # documentation is help/epilog/args # noqa: D103
283
284
  *,
284
- ctx: typer.Context,
285
+ ctx: click.Context,
285
286
  message: str = typer.Argument(..., help='Message that was signed earlier'),
286
287
  signature: str = typer.Argument(..., help='Putative signature for `message`'),
287
288
  aad: str = typer.Option(
@@ -339,7 +340,7 @@ transcrypto.app.add_typer(eg_app, name='elgamal')
339
340
  @clibase.CLIErrorGuard
340
341
  def ElGamalShared( # documentation is help/epilog/args # noqa: D103
341
342
  *,
342
- ctx: typer.Context,
343
+ ctx: click.Context,
343
344
  bits: int = typer.Option(
344
345
  3332,
345
346
  '-b',
@@ -365,7 +366,7 @@ def ElGamalShared( # documentation is help/epilog/args # noqa: D103
365
366
  ),
366
367
  )
367
368
  @clibase.CLIErrorGuard
368
- def ElGamalNew(*, ctx: typer.Context) -> None: # documentation is help/epilog/args # noqa: D103
369
+ def ElGamalNew(*, ctx: click.Context) -> None: # documentation is help/epilog/args # noqa: D103
369
370
  config: transcrypto.TransConfig = ctx.obj
370
371
  base_path: str = transcrypto.RequireKeyPath(config, 'elgamal')
371
372
  shared_eg: elgamal.ElGamalSharedPublicKey = transcrypto.LoadObj(
@@ -393,7 +394,7 @@ def ElGamalNew(*, ctx: typer.Context) -> None: # documentation is help/epilog/a
393
394
  @clibase.CLIErrorGuard
394
395
  def ElGamalRawEncrypt( # documentation is help/epilog/args # noqa: D103
395
396
  *,
396
- ctx: typer.Context,
397
+ ctx: click.Context,
397
398
  message: str = typer.Argument(..., help='Integer message to encrypt, 1≤`message`<*modulus*'),
398
399
  ) -> None:
399
400
  config: transcrypto.TransConfig = ctx.obj
@@ -424,7 +425,7 @@ def ElGamalRawEncrypt( # documentation is help/epilog/args # noqa: D103
424
425
  @clibase.CLIErrorGuard
425
426
  def ElGamalRawDecrypt( # documentation is help/epilog/args # noqa: D103
426
427
  *,
427
- ctx: typer.Context,
428
+ ctx: click.Context,
428
429
  ciphertext: str = typer.Argument(
429
430
  ...,
430
431
  help=(
@@ -457,7 +458,7 @@ def ElGamalRawDecrypt( # documentation is help/epilog/args # noqa: D103
457
458
  @clibase.CLIErrorGuard
458
459
  def ElGamalRawSign( # documentation is help/epilog/args # noqa: D103
459
460
  *,
460
- ctx: typer.Context,
461
+ ctx: click.Context,
461
462
  message: str = typer.Argument(..., help='Integer message to sign, 1≤`message`<*modulus*'),
462
463
  ) -> None:
463
464
  config: transcrypto.TransConfig = ctx.obj
@@ -491,7 +492,7 @@ def ElGamalRawSign( # documentation is help/epilog/args # noqa: D103
491
492
  @clibase.CLIErrorGuard
492
493
  def ElGamalRawVerify( # documentation is help/epilog/args # noqa: D103
493
494
  *,
494
- ctx: typer.Context,
495
+ ctx: click.Context,
495
496
  message: str = typer.Argument(
496
497
  ..., help='Integer message that was signed earlier, 1≤`message`<*modulus*'
497
498
  ),
@@ -528,7 +529,7 @@ def ElGamalRawVerify( # documentation is help/epilog/args # noqa: D103
528
529
  @clibase.CLIErrorGuard
529
530
  def ElGamalEncrypt( # documentation is help/epilog/args # noqa: D103
530
531
  *,
531
- ctx: typer.Context,
532
+ ctx: click.Context,
532
533
  plaintext: str = typer.Argument(..., help='Message to encrypt'),
533
534
  aad: str = typer.Option(
534
535
  '',
@@ -561,7 +562,7 @@ def ElGamalEncrypt( # documentation is help/epilog/args # noqa: D103
561
562
  @clibase.CLIErrorGuard
562
563
  def ElGamalDecrypt( # documentation is help/epilog/args # noqa: D103
563
564
  *,
564
- ctx: typer.Context,
565
+ ctx: click.Context,
565
566
  ciphertext: str = typer.Argument(..., help='Ciphertext to decrypt'),
566
567
  aad: str = typer.Option(
567
568
  '',
@@ -593,7 +594,7 @@ def ElGamalDecrypt( # documentation is help/epilog/args # noqa: D103
593
594
  @clibase.CLIErrorGuard
594
595
  def ElGamalSign( # documentation is help/epilog/args # noqa: D103
595
596
  *,
596
- ctx: typer.Context,
597
+ ctx: click.Context,
597
598
  message: str = typer.Argument(..., help='Message to sign'),
598
599
  aad: str = typer.Option(
599
600
  '',
@@ -629,7 +630,7 @@ def ElGamalSign( # documentation is help/epilog/args # noqa: D103
629
630
  @clibase.CLIErrorGuard
630
631
  def ElGamalVerify( # documentation is help/epilog/args # noqa: D103
631
632
  *,
632
- ctx: typer.Context,
633
+ ctx: click.Context,
633
634
  message: str = typer.Argument(..., help='Message that was signed earlier'),
634
635
  signature: str = typer.Argument(..., help='Putative signature for `message`'),
635
636
  aad: str = typer.Option(
@@ -690,7 +691,7 @@ transcrypto.app.add_typer(dsa_app, name='dsa')
690
691
  @clibase.CLIErrorGuard
691
692
  def DSAShared( # documentation is help/epilog/args # noqa: D103
692
693
  *,
693
- ctx: typer.Context,
694
+ ctx: click.Context,
694
695
  p_bits: int = typer.Option(
695
696
  4096,
696
697
  '-b',
@@ -726,7 +727,7 @@ def DSAShared( # documentation is help/epilog/args # noqa: D103
726
727
  ),
727
728
  )
728
729
  @clibase.CLIErrorGuard
729
- def DSANew(*, ctx: typer.Context) -> None: # documentation is help/epilog/args # noqa: D103
730
+ def DSANew(*, ctx: click.Context) -> None: # documentation is help/epilog/args # noqa: D103
730
731
  config: transcrypto.TransConfig = ctx.obj
731
732
  base_path: str = transcrypto.RequireKeyPath(config, 'dsa')
732
733
  dsa_shared: dsa.DSASharedPublicKey = transcrypto.LoadObj(
@@ -754,7 +755,7 @@ def DSANew(*, ctx: typer.Context) -> None: # documentation is help/epilog/args
754
755
  @clibase.CLIErrorGuard
755
756
  def DSARawSign( # documentation is help/epilog/args # noqa: D103
756
757
  *,
757
- ctx: typer.Context,
758
+ ctx: click.Context,
758
759
  message: str = typer.Argument(..., help='Integer message to sign, 1≤`message`<`q`'),
759
760
  ) -> None:
760
761
  config: transcrypto.TransConfig = ctx.obj
@@ -785,7 +786,7 @@ def DSARawSign( # documentation is help/epilog/args # noqa: D103
785
786
  @clibase.CLIErrorGuard
786
787
  def DSARawVerify( # documentation is help/epilog/args # noqa: D103
787
788
  *,
788
- ctx: typer.Context,
789
+ ctx: click.Context,
789
790
  message: str = typer.Argument(
790
791
  ..., help='Integer message that was signed earlier, 1≤`message`<`q`'
791
792
  ),
@@ -822,7 +823,7 @@ def DSARawVerify( # documentation is help/epilog/args # noqa: D103
822
823
  @clibase.CLIErrorGuard
823
824
  def DSASign( # documentation is help/epilog/args # noqa: D103
824
825
  *,
825
- ctx: typer.Context,
826
+ ctx: click.Context,
826
827
  message: str = typer.Argument(..., help='Message to sign'),
827
828
  aad: str = typer.Option(
828
829
  '',
@@ -856,7 +857,7 @@ def DSASign( # documentation is help/epilog/args # noqa: D103
856
857
  @clibase.CLIErrorGuard
857
858
  def DSAVerify( # documentation is help/epilog/args # noqa: D103
858
859
  *,
859
- ctx: typer.Context,
860
+ ctx: click.Context,
860
861
  message: str = typer.Argument(..., help='Message that was signed earlier'),
861
862
  signature: str = typer.Argument(..., help='Putative signature for `message`'),
862
863
  aad: str = typer.Option(
transcrypto/profiler.py CHANGED
@@ -21,6 +21,7 @@ from __future__ import annotations
21
21
  import dataclasses
22
22
  from collections import abc
23
23
 
24
+ import click
24
25
  import typer
25
26
  from rich import console as rich_console
26
27
 
@@ -78,7 +79,7 @@ def Run() -> None:
78
79
  @clibase.CLIErrorGuard
79
80
  def Main( # documentation is help/epilog/args # noqa: D103
80
81
  *,
81
- ctx: typer.Context, # global context
82
+ ctx: click.Context, # global context
82
83
  version: bool = typer.Option(False, '--version', help='Show version and exit.'),
83
84
  verbose: int = typer.Option(
84
85
  0,
@@ -173,7 +174,7 @@ def Main( # documentation is help/epilog/args # noqa: D103
173
174
  ),
174
175
  )
175
176
  @clibase.CLIErrorGuard
176
- def Primes(*, ctx: typer.Context) -> None: # documentation is help/epilog/args # noqa: D103
177
+ def Primes(*, ctx: click.Context) -> None: # documentation is help/epilog/args # noqa: D103
177
178
  config: ProfilerConfig = ctx.obj # get application global config
178
179
  config.console.print(
179
180
  f'Starting [yellow]{"SERIAL" if config.serial else "PARALLEL"} regular primes[/] test'
@@ -203,7 +204,7 @@ def Primes(*, ctx: typer.Context) -> None: # documentation is help/epilog/args
203
204
  ),
204
205
  )
205
206
  @clibase.CLIErrorGuard
206
- def DSA(*, ctx: typer.Context) -> None: # documentation is help/epilog/args # noqa: D103
207
+ def DSA(*, ctx: click.Context) -> None: # documentation is help/epilog/args # noqa: D103
207
208
  config: ProfilerConfig = ctx.obj # get application global config
208
209
  config.console.print(
209
210
  f'Starting [yellow]{"SERIAL" if config.serial else "PARALLEL"} DSA primes[/] test'
@@ -462,7 +462,7 @@ def Main( # documentation is help/epilog/args # noqa: D103
462
462
  ),
463
463
  )
464
464
  @clibase.CLIErrorGuard
465
- def Markdown(*, ctx: typer.Context) -> None: # documentation is help/epilog/args # noqa: D103
465
+ def Markdown(*, ctx: click.Context) -> None: # documentation is help/epilog/args # noqa: D103
466
466
  config: TransConfig = ctx.obj
467
467
  config.console.print(clibase.GenerateTyperHelpMarkdown(app, prog_name='transcrypto'))
468
468
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: transcrypto
3
- Version: 2.0.0
3
+ Version: 2.0.3
4
4
  Summary: Basic crypto primitives, not intended for actual use, but as a companion to --Criptografia, Métodos e Algoritmos--
5
5
  License-Expression: Apache-2.0
6
6
  License-File: LICENSE
@@ -18,7 +18,7 @@ Classifier: Topic :: Security :: Cryptography
18
18
  Requires-Dist: cryptography (>=46.0)
19
19
  Requires-Dist: gmpy2 (>=2.2)
20
20
  Requires-Dist: platformdirs (>=4.5)
21
- Requires-Dist: rich (>=14.3)
21
+ Requires-Dist: rich (>=14.3,!=14.3.2)
22
22
  Requires-Dist: typer (>=0.21)
23
23
  Requires-Dist: zstandard (>=0.25)
24
24
  Project-URL: Changelog, https://github.com/balparda/transcrypto/blob/main/CHANGELOG.md
@@ -1,10 +1,10 @@
1
- transcrypto/__init__.py,sha256=rR2iNiYIz11plYoFGy8HoLZeXxFDKEGd_tZCgHXE2cU,338
1
+ transcrypto/__init__.py,sha256=KzOwhHreEpfs1UwMqoH9EJaAfKp1_jgdwNTvORRDTM0,338
2
2
  transcrypto/cli/__init__.py,sha256=VyfdjELABx6yaiAQrFlK7WDa96j2O12umoy1WunqbLw,134
3
- transcrypto/cli/aeshash.py,sha256=VvL-aIe1u4JOqNRM7khVqTg-p85913HOcRa8FQLwO3I,13784
4
- transcrypto/cli/bidsecret.py,sha256=0W14gEoNTcBFP_5yk2HiFBUMMRTJgtLAksKMoXkQhDc,12593
5
- transcrypto/cli/clibase.py,sha256=nGqMhA8Ad9OFovPAsikaYdK1e5CFDmpDsSNyVjhSJtM,5988
6
- transcrypto/cli/intmath.py,sha256=mtLVEmss5i62q5OyYbCwF2P1MqAssN_cCpq0AOozz6g,14477
7
- transcrypto/cli/publicalgos.py,sha256=K9MdqsDHCXYzrs9I0cFcgSvTIM25kc1iV02tsb5E05s,31394
3
+ transcrypto/cli/aeshash.py,sha256=bO3p5ZRLoqc7pM-FKWR6kvDyrAteVZCCeLdpuRQckWU,13784
4
+ transcrypto/cli/bidsecret.py,sha256=2jxgTyIt0l2VN39kTiMJt7W9H33DfDBM7W0lMnduRiU,12606
5
+ transcrypto/cli/clibase.py,sha256=po0-K_xcbUtF8sJ7shrNWvmonPfUmJfLJg3vhA4LTsA,5988
6
+ transcrypto/cli/intmath.py,sha256=kpVfeWmevG6dq_jLvObKHA2mUtejcwnplwhUK3qZigg,14490
7
+ transcrypto/cli/publicalgos.py,sha256=b2KN2_72EKhVNjiR2fIWgZSQaVhC8TIDpeAvtI9lJNg,31407
8
8
  transcrypto/core/__init__.py,sha256=g7Nfe2TgWVTqr8vbEdOmNWhYrIUPgfbDHplq4v_WaJA,142
9
9
  transcrypto/core/aes.py,sha256=ZQ9kq0--4FqgvsL8YKfs5zQjSTnP-I2Uvg4SvZoJPY0,14314
10
10
  transcrypto/core/bid.py,sha256=eB73pSBQSdK54RG5bjO4l_r8IR6CrBHHnZHfuoYZn-U,4916
@@ -16,9 +16,9 @@ transcrypto/core/key.py,sha256=EPkwQVtgu0maBXPdN2Fl4syMqONJPt_gVij78L1h0uc,26620
16
16
  transcrypto/core/modmath.py,sha256=bDsK4VxvrAhut0dQjTWwJqzhuuumpmSDspl1IIl0aqA,23051
17
17
  transcrypto/core/rsa.py,sha256=UjuTu6KFB_wCH3i2Pe8P6NF-KD4e5jXk1XrijIuFidw,24323
18
18
  transcrypto/core/sss.py,sha256=w-oKzOK6uJL8oh5T0IQNW0fWFMjQMBFUNVq4WOv94wg,17084
19
- transcrypto/profiler.py,sha256=yuZSDfJs-2VsrtLzQgRCR9LR92nER59EmcEYKeSFFW8,7874
19
+ transcrypto/profiler.py,sha256=UfSTWpvD0TnV6YCPoDvgnQQ4XBuJNZaD813F2glFRhE,7887
20
20
  transcrypto/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
21
- transcrypto/transcrypto.py,sha256=V89JREdr_8AiLzbrnTjtDUkt-GSBHOBzC-iHk02qyMI,16907
21
+ transcrypto/transcrypto.py,sha256=aHtbkZNEMfFG_7Ul8UaGI4wwQEZWlPuBTQB38gvQDDs,16907
22
22
  transcrypto/utils/__init__.py,sha256=ySgjEaInsgHkHlzUKIc6calJ0Or_JzbPaQHlF4TfLsM,140
23
23
  transcrypto/utils/base.py,sha256=5vWxOTqS0vmCffgnNBcFfzo_UChed3isyeRn_66nTT4,2329
24
24
  transcrypto/utils/human.py,sha256=DGB2rQ9v75Amo767Cp9MPN6192-azAIWHKOdk_ynSvY,8983
@@ -26,8 +26,8 @@ transcrypto/utils/logging.py,sha256=UrW8CLAaVAe-WRDvNEkWeH-viMI98a0w70Ag9aEP-mk,
26
26
  transcrypto/utils/saferandom.py,sha256=mLP6tpz6Ts1oYtDlcbw0MaNIvVQxTD_WHwKMYv9_hrY,2977
27
27
  transcrypto/utils/stats.py,sha256=69Mgi4WMBm1Iqm2HEDUL1qLxfQjle4zcTXHah5wD-bA,11668
28
28
  transcrypto/utils/timer.py,sha256=IhCYKq-O1xu-1VrO34wKJ8LN5UZZvA5j1tV1d4BvZf0,4789
29
- transcrypto-2.0.0.dist-info/METADATA,sha256=j6nL5Phgyux1Qpl3iNO5FrPyu9HoL47etRnh7grXuIo,39462
30
- transcrypto-2.0.0.dist-info/WHEEL,sha256=3ny-bZhpXrU6vSQ1UPG34FoxZBp3lVcvK0LkgUz6VLk,88
31
- transcrypto-2.0.0.dist-info/entry_points.txt,sha256=HXJ1yXZJT_9OhLJgEhv2toOpxwhDaIU2HuW91MTJDIg,93
32
- transcrypto-2.0.0.dist-info/licenses/LICENSE,sha256=DVQuDIgE45qn836wDaWnYhSdxoLXgpRRKH4RuTjpRZQ,10174
33
- transcrypto-2.0.0.dist-info/RECORD,,
29
+ transcrypto-2.0.3.dist-info/METADATA,sha256=LUzTGCWDwgp9qkCNGn_y7cZEb14LX1IAyD2zTuuGgg4,39471
30
+ transcrypto-2.0.3.dist-info/WHEEL,sha256=kJCRJT_g0adfAJzTx2GUMmS80rTJIVHRCfG0DQgLq3o,88
31
+ transcrypto-2.0.3.dist-info/entry_points.txt,sha256=HXJ1yXZJT_9OhLJgEhv2toOpxwhDaIU2HuW91MTJDIg,93
32
+ transcrypto-2.0.3.dist-info/licenses/LICENSE,sha256=DVQuDIgE45qn836wDaWnYhSdxoLXgpRRKH4RuTjpRZQ,10174
33
+ transcrypto-2.0.3.dist-info/RECORD,,
@@ -1,4 +1,4 @@
1
1
  Wheel-Version: 1.0
2
- Generator: poetry-core 2.3.0
2
+ Generator: poetry-core 2.3.1
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any