zora-cli 0.1.4__tar.gz → 0.2__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: zora-cli
3
- Version: 0.1.4
3
+ Version: 0.2
4
4
  Summary: Cryptographically secure generator of random keys with tons of options and customizations.
5
5
  Author: zscopuv
6
6
  License: ZORA SOURCE-AVAILABLE LICENSE
@@ -228,13 +228,15 @@ Requires-Dist: packaging>=24.0
228
228
  Dynamic: license-file
229
229
 
230
230
  # ![Logo](https://i.ibb.co/21JfnbBZ/zora.jpg)
231
- > **Early release (`v0.1.4`)**
232
231
 
233
- Zora generates random keys using Python's cryptographically secure
234
- `secrets` module by default. It supports customizable character sets,
235
- charset presets, prefixes, suffixes, grouping, multiple outputs, file
236
- output, entropy estimation, and an optional deterministic PRNG mode.
232
+ > **Early release (`v0.2`)**
237
233
 
234
+ Zora is a command-line tool for generating random keys using Python's
235
+ cryptographically secure `secrets` module by default.
236
+
237
+ It supports customizable character sets, composable charset presets,
238
+ prefixes, suffixes, grouping, multiple output formats, file output,
239
+ entropy estimation, benchmarking, and an optional deterministic PRNG mode.
238
240
 
239
241
  ---
240
242
 
@@ -245,22 +247,33 @@ output, entropy estimation, and an optional deterministic PRNG mode.
245
247
  - 🎲 **Deterministic generation** with `--seed` in unsafe mode
246
248
  - 🔤 **Custom character sets**
247
249
  - 🧩 **Composable charset presets** such as `@letters@digits`
248
- - 🔢 **Built-in hexadecimal, octal, binary, digit, and symbol presets**
250
+ - ⚡ **Fast charset shorthand** with `-x`
251
+ - 🔢 **28 built-in charset presets**
249
252
  - ➕ Add **custom characters** to presets
250
253
  - 📏 Configurable **key length**
251
254
  - 📦 Generate **multiple keys** at once
252
255
  - 🔗 Add **prefixes and suffixes**
253
256
  - 📐 **Group keys with custom separators**
254
257
  - 💾 Write generated **keys to a file**
258
+ - 📤 Multiple output formats: **Text, JSON, CSV, XML, YAML**
255
259
  - 📊 Calculate **theoretical entropy**
256
260
  - 💪 **Estimate key strength** from entropy
257
261
  - ⏱️ Display **generation time**
262
+ - 🏁 **Benchmark key generation**
258
263
  - 🤫 **Quiet mode** for scripting
259
264
  - 📋 **Charset preset listing**
265
+ - 🔍 **Charset and argument validation**
266
+ - ℹ️ Display the installed version with `--version`
267
+
268
+ ---
260
269
 
261
- ## Installation
270
+ # Installation
262
271
 
263
- ### Requirements
272
+ ## Requirements
273
+
274
+ Python 3.9 or newer is recommended.
275
+
276
+ Install Zora from PyPI:
264
277
 
265
278
  ```bash
266
279
  pip install zora-cli
@@ -272,6 +285,16 @@ Run Zora:
272
285
  zora 32
273
286
  ```
274
287
 
288
+ ### Optional YAML support
289
+
290
+ YAML output requires PyYAML:
291
+
292
+ ```bash
293
+ pip install pyyaml
294
+ ```
295
+
296
+ ---
297
+
275
298
  # Usage
276
299
 
277
300
  Basic usage:
@@ -292,6 +315,7 @@ Example output:
292
315
  GxKqTnJpYwRzLhBcVfQmNsXeUaPkTdWr
293
316
 
294
317
  Timer: 13ms elapsed
318
+
295
319
  Charset: 52
296
320
  Entropy: 182.41 bits
297
321
  Strength: Very strong
@@ -314,44 +338,123 @@ The value must be greater than `0`.
314
338
 
315
339
  ---
316
340
 
317
- ## `--charset`
341
+ ## `--version`
318
342
 
319
- Select the character set used to generate keys.
343
+ Display the currently installed Zora version:
320
344
 
321
345
  ```bash
322
- zora 32 --charset @digits
346
+ zora --version
347
+ ```
348
+
349
+ Example:
350
+
351
+ ```text
352
+ zora 0.2.0
323
353
  ```
324
354
 
325
- By default:
355
+ ---
356
+
357
+ ## `--charset` / `-x`
358
+
359
+ Select the character set used to generate keys.
360
+
361
+ The default charset is:
326
362
 
327
363
  ```text
328
364
  @letters
329
365
  ```
330
366
 
331
- is used.
367
+ Long form:
368
+
369
+ ```bash
370
+ zora 32 --charset @digits
371
+ ```
372
+
373
+ Short form:
374
+
375
+ ```bash
376
+ zora 32 -x @digits
377
+ ```
378
+
379
+ The `-x` option is provided as a convenient shorthand for faster charset selection.
332
380
 
333
381
  Zora supports both predefined charset presets and literal characters.
334
382
 
335
- ### Presets
383
+ ---
384
+
385
+ ## Charset presets
336
386
 
337
- Use `--charset-list` to display all available presets:
387
+ Use:
338
388
 
339
389
  ```bash
340
390
  zora --charset-list
341
391
  ```
342
392
 
343
- Currently available presets:
393
+ to display all available presets.
394
+
395
+ ## Basic
396
+
397
+ | Preset | Characters |
398
+ | ---------- | ----------------------- |
399
+ | `@digits` | `0-9` |
400
+ | `@letters` | `a-zA-Z` |
401
+ | `@lower` | `a-z` |
402
+ | `@upper` | `A-Z` |
403
+ | `@special` | Punctuation and symbols |
404
+
405
+ ## Numeric
406
+
407
+ | Preset | Characters |
408
+ | --------- | ------------------------ |
409
+ | `@bin` | `01` |
410
+ | `@oct` | `01234567` |
411
+ | `@hex` | `0123456789ABCDEF` |
412
+ | `@lhex` | `0123456789abcdef` |
413
+ | `@allhex` | `0123456789ABCDEFabcdef` |
344
414
 
345
- | Preset | Characters |
346
- | ---------- | ----------------------------- |
347
- | `@digits` | `0-9` |
348
- | `@letters` | `a-zA-Z` |
349
- | `@lower` | `a-z` |
350
- | `@upper` | `A-Z` |
351
- | `@hex` | `0-9ABCDEFabcdef` |
352
- | `@oct` | `01234567` |
353
- | `@bin` | `01` |
354
- | `@special` | all punctuation/symbol characters |
415
+ ## URL / filename friendly
416
+
417
+ | Preset | Characters |
418
+ | ----------- | -------------------------------- |
419
+ | `@url` | URL-friendly characters |
420
+ | `@urlsafe` | URL-safe alphanumeric characters |
421
+ | `@filename` | Filename-safe characters |
422
+
423
+ ## Human-friendly
424
+
425
+ These presets avoid characters that can easily be confused with one another.
426
+
427
+ | Preset | Description |
428
+ | ------------- | ----------------------------- |
429
+ | `@lowersafe` | Lowercase without `l` |
430
+ | `@uppersafe` | Uppercase without `I` and `O` |
431
+ | `@digitssafe` | Digits without `0` and `1` |
432
+
433
+ ## Base encodings
434
+
435
+ | Preset | Description |
436
+ | ---------- | ------------------------- |
437
+ | `@base32` | Uppercase Base32 alphabet |
438
+ | `@base32x` | Lowercase Base32 alphabet |
439
+ | `@base36` | Uppercase Base36 alphabet |
440
+ | `@base36x` | Lowercase Base36 alphabet |
441
+ | `@base62` | Base62 alphabet |
442
+
443
+ ## Base64
444
+
445
+ | Preset | Description |
446
+ | ------------ | ------------------------ |
447
+ | `@base64` | Standard Base64 alphabet |
448
+ | `@base64url` | URL-safe Base64 alphabet |
449
+
450
+ ## Symbols
451
+
452
+ | Preset | Characters |
453
+ | ----------- | --------------------------- |
454
+ | `@symbols` | Punctuation and symbols |
455
+ | `@brackets` | `()[]{}<>` |
456
+ | `@quotes` | Quote characters |
457
+ | `@math` | Common mathematical symbols |
355
458
 
356
459
  ---
357
460
 
@@ -365,7 +468,7 @@ zora 32 --charset @letters@digits
365
468
 
366
469
  This creates an alphanumeric character set.
367
470
 
368
- Multiple presets can be combined:
471
+ Multiple presets can also be combined:
369
472
 
370
473
  ```bash
371
474
  zora 32 --charset @upper@lower@digits
@@ -381,6 +484,12 @@ For example:
381
484
 
382
485
  does not contain uppercase characters twice.
383
486
 
487
+ The short `-x` form can be used as well:
488
+
489
+ ```bash
490
+ zora 32 -x @upper@lower@digits
491
+ ```
492
+
384
493
  ---
385
494
 
386
495
  ## Custom characters
@@ -411,44 +520,43 @@ means:
411
520
  X + Y + Z + @hex
412
521
  ```
413
522
 
414
- This allows arbitrary character sets without needing to add a new preset.
523
+ This allows arbitrary character sets without requiring a new preset.
415
524
 
416
525
  ---
417
526
 
418
- # `--charset-list`
527
+ ## `--charset-list`
419
528
 
420
- Display the available charset presets:
529
+ Display all available charset presets:
421
530
 
422
531
  ```bash
423
532
  zora --charset-list
424
533
  ```
425
534
 
535
+ The output includes the preset name and its characters.
536
+
426
537
  Example:
427
538
 
428
539
  ```text
429
540
  Available charsets:
430
-
431
- @digits
432
- @letters
433
- @lower
434
- @upper
435
- @hex
436
- @oct
437
- @bin
438
- @special
541
+ @digits = 0123456789
542
+ @letters = abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ
543
+ @lower = abcdefghijklmnopqrstuvwxyz
544
+ @upper = ABCDEFGHIJKLMNOPQRSTUVWXYZ
545
+ ...
439
546
 
440
547
  Use as:
441
-
442
548
  zora --charset @digits
443
549
  zora --charset @letters@digits
444
550
  zora --charset @hexXYZ
445
551
  ```
446
552
 
553
+ This mode exits immediately after displaying the available presets.
554
+
447
555
  ---
448
556
 
449
557
  # Multiple keys
450
558
 
451
- Use `-n` or `--count`:
559
+ Use `-n` or `--count` to generate multiple keys:
452
560
 
453
561
  ```bash
454
562
  zora 32 --count 10
@@ -460,7 +568,7 @@ or:
460
568
  zora 32 -n 10
461
569
  ```
462
570
 
463
- Zora generates each key independently.
571
+ Each key is generated independently.
464
572
 
465
573
  When using the secure default generator, each key is generated using the
466
574
  cryptographically secure random generator.
@@ -537,24 +645,96 @@ entropy.
537
645
 
538
646
  ---
539
647
 
648
+ # Output formats
649
+
650
+ Zora supports multiple output formats through `--format`.
651
+
652
+ Available formats:
653
+
654
+ * `text`
655
+ * `json`
656
+ * `csv`
657
+ * `xml`
658
+ * `yml`
659
+
660
+ The default format is `text`.
661
+
662
+ ## Text
663
+
664
+ ```bash
665
+ zora 32 --format text
666
+ ```
667
+
668
+ This is the default output format.
669
+
670
+ ## JSON
671
+
672
+ ```bash
673
+ zora 32 -n 3 --format json
674
+ ```
675
+
676
+ Example:
677
+
678
+ ```json
679
+ {
680
+ "keys": [
681
+ "GxKqTnJpYwRzLhBcVfQmNsXeUaPkTdWr",
682
+ "...",
683
+ "..."
684
+ ]
685
+ }
686
+ ```
687
+
688
+ ## CSV
689
+
690
+ ```bash
691
+ zora 32 -n 3 --format csv
692
+ ```
693
+
694
+ The generated CSV contains a `key` column.
695
+
696
+ ## XML
697
+
698
+ ```bash
699
+ zora 32 -n 3 --format xml
700
+ ```
701
+
702
+ ## YAML
703
+
704
+ ```bash
705
+ zora 32 -n 3 --format yml
706
+ ```
707
+
708
+ YAML output requires PyYAML:
709
+
710
+ ```bash
711
+ pip install pyyaml
712
+ ```
713
+
714
+ ---
715
+
540
716
  # File output
541
717
 
542
- Use `-o` or `--output` to write generated keys to a file:
718
+ Use `-o` or `--output` to write generated output to a file:
543
719
 
544
720
  ```bash
545
721
  zora 32 -n 10 --output keys.txt
546
722
  ```
547
723
 
548
- The generated keys are written one per line.
724
+ The output format can be selected independently:
549
725
 
550
- Example:
726
+ ```bash
727
+ zora 32 -n 10 --format json -o keys.json
728
+ ```
551
729
 
552
- ```text
553
- GxKqTnJpYwRzLhBcVfQmNsXeUaPkTdWr
554
- aQmXzPjLtVrNsYkBcWdHgFqAeUxRoZiLp
555
- ...
730
+ ```bash
731
+ zora 32 -n 10 --format csv -o keys.csv
556
732
  ```
557
733
 
734
+ Generated files use UTF-8 encoding.
735
+
736
+ Text-based CLI output uses a conventional final newline.
737
+
558
738
  ---
559
739
 
560
740
  # Secure generation
@@ -644,6 +824,45 @@ rather than being reseeded for every key.
644
824
 
645
825
  ---
646
826
 
827
+ # Benchmarking
828
+
829
+ Use `--benchmark` to benchmark key generation:
830
+
831
+ ```bash
832
+ zora 32 --benchmark
833
+ ```
834
+
835
+ The benchmark reports:
836
+
837
+ * Generator
838
+ * Key length
839
+ * Number of keys
840
+ * Charset size
841
+ * Total characters generated
842
+ * Keys per second
843
+ * Characters per second
844
+
845
+ Example:
846
+
847
+ ```text
848
+ Zora Benchmark
849
+ ────────────────────────────────
850
+ Generator: CSPRNG
851
+ Length: 32
852
+ Count: 1
853
+ Charset: 52
854
+ Characters: 32
855
+ Keys/sec: ...
856
+ Characters/sec: ...
857
+ ```
858
+
859
+ Benchmarking does not produce normal key output.
860
+
861
+ The benchmark respects `--unsafe`, `--seed`, `--count`, and the selected
862
+ charset.
863
+
864
+ ---
865
+
647
866
  # Quiet mode
648
867
 
649
868
  Use `-q` or `--quiet` to suppress non-essential output:
@@ -660,25 +879,31 @@ For example:
660
879
  zora 32 --quiet > key.txt
661
880
  ```
662
881
 
882
+ Quiet mode suppresses the timer, entropy, strength, generator information,
883
+ and update notification.
884
+
663
885
  ---
664
886
 
665
887
  # Entropy
666
888
 
667
- Zora calculates the theoretical entropy of the random portion of the
668
- key.
889
+ Zora calculates the theoretical entropy of the random portion of the key.
669
890
 
670
891
  The formula is:
671
892
 
672
- $entropy = length \times \log{_2}{(charset size)}$
893
+ ```text
894
+ entropy = length × log₂(charset size)
895
+ ```
673
896
 
674
897
  For example, using 52 possible characters:
675
898
 
676
- $32 \times log{_2}\space 52$
899
+ ```text
900
+ 32 × log₂(52)
901
+ ```
677
902
 
678
903
  produces approximately:
679
904
 
680
905
  ```text
681
- 182.17 bits
906
+ 182.41 bits
682
907
  ```
683
908
 
684
909
  The entropy calculation only considers random characters.
@@ -733,6 +958,25 @@ PRNG
733
958
 
734
959
  ---
735
960
 
961
+ # Argument validation
962
+
963
+ Zora validates command-line arguments before generating keys.
964
+
965
+ Examples of invalid arguments include:
966
+
967
+ * A key length of `0` or less
968
+ * A key length missing when generation is requested
969
+ * A `--group` value greater than the key length
970
+ * Using `--seed` without `--unsafe`
971
+ * An unknown charset preset
972
+ * An empty final charset
973
+ * A charset containing fewer than two unique characters
974
+
975
+ Invalid arguments result in a clear command-line error instead of
976
+ attempting to generate invalid output.
977
+
978
+ ---
979
+
736
980
  # Example commands
737
981
 
738
982
  ### Basic key
@@ -744,49 +988,55 @@ zora 32
744
988
  ### Digits only
745
989
 
746
990
  ```bash
747
- zora 32 --charset @digits
991
+ zora 32 -x @digits
748
992
  ```
749
993
 
750
994
  ### Lowercase only
751
995
 
752
996
  ```bash
753
- zora 32 --charset @lower
997
+ zora 32 -x @lower
754
998
  ```
755
999
 
756
1000
  ### Uppercase only
757
1001
 
758
1002
  ```bash
759
- zora 32 --charset @upper
1003
+ zora 32 -x @upper
760
1004
  ```
761
1005
 
762
1006
  ### Alphanumeric
763
1007
 
764
1008
  ```bash
765
- zora 32 --charset @letters@digits
1009
+ zora 32 -x @letters@digits
766
1010
  ```
767
1011
 
768
1012
  ### Hexadecimal
769
1013
 
770
1014
  ```bash
771
- zora 32 --charset @hex
1015
+ zora 32 -x @hex
772
1016
  ```
773
1017
 
774
1018
  ### Hexadecimal plus custom characters
775
1019
 
776
1020
  ```bash
777
- zora 32 --charset @hexXYZ
1021
+ zora 32 -x @hexXYZ
778
1022
  ```
779
1023
 
780
1024
  ### Uppercase, lowercase and digits
781
1025
 
782
1026
  ```bash
783
- zora 32 --charset @upper@lower@digits
1027
+ zora 32 -x @upper@lower@digits
1028
+ ```
1029
+
1030
+ ### Human-friendly digits
1031
+
1032
+ ```bash
1033
+ zora 32 -x @digitssafe
784
1034
  ```
785
1035
 
786
1036
  ### Symbols
787
1037
 
788
1038
  ```bash
789
- zora 32 --charset @special
1039
+ zora 32 -x @symbols
790
1040
  ```
791
1041
 
792
1042
  ### Group the output
@@ -813,6 +1063,30 @@ zora 32 -n 10
813
1063
  zora 32 -n 100 -o keys.txt
814
1064
  ```
815
1065
 
1066
+ ### JSON output
1067
+
1068
+ ```bash
1069
+ zora 32 -n 10 --format json
1070
+ ```
1071
+
1072
+ ### Benchmark
1073
+
1074
+ ```bash
1075
+ zora 32 --benchmark
1076
+ ```
1077
+
1078
+ ### Show available charsets
1079
+
1080
+ ```bash
1081
+ zora --charset-list
1082
+ ```
1083
+
1084
+ ### Show version
1085
+
1086
+ ```bash
1087
+ zora --version
1088
+ ```
1089
+
816
1090
  ### Prefix
817
1091
 
818
1092
  ```bash
@@ -894,7 +1168,9 @@ random output space.
894
1168
  For example, a 32-character key selected uniformly from 62 possible
895
1169
  characters has:
896
1170
 
897
- $32 \times log{_2}\space 62$
1171
+ ```text
1172
+ 32 × log₂(62)
1173
+ ```
898
1174
 
899
1175
  bits of theoretical entropy.
900
1176
 
@@ -915,8 +1191,8 @@ The generator is nevertheless explicitly marked:
915
1191
  Generator: PRNG
916
1192
  ```
917
1193
 
918
- and the entropy/strength display is visually marked when `--unsafe` is
919
- used.
1194
+ and the entropy and strength display is visually marked when `--unsafe`
1195
+ is used.
920
1196
 
921
1197
  ---
922
1198
 
@@ -941,6 +1217,12 @@ Run:
941
1217
  zora 32
942
1218
  ```
943
1219
 
1220
+ For YAML output, install PyYAML:
1221
+
1222
+ ```bash
1223
+ pip install pyyaml
1224
+ ```
1225
+
944
1226
  ---
945
1227
 
946
1228
  # Roadmap
@@ -951,12 +1233,14 @@ Possible future improvements include:
951
1233
  * [x] Improved documentation
952
1234
  * [x] Installation through `pip`
953
1235
  * [x] Packaging with `pyproject.toml`
954
- * [ ] Automated test suite
955
- * [ ] Better charset parsing errors
1236
+ * [x] Better charset parsing errors
1237
+ * [x] Multiple output formats
1238
+ * [x] Benchmarking mode
1239
+ * [x] Version information
1240
+ * [x] Argument validation
1241
+ * [x] Automated test suite
956
1242
  * [ ] Configuration files
957
1243
  * [ ] Shell completion
958
- * [ ] More output formats
959
- * [ ] Benchmarking mode
960
1244
  * [ ] Cross-platform terminal improvements
961
1245
  * [ ] API/library usage
962
1246
  * [ ] More extensive security testing
@@ -976,7 +1260,7 @@ MAJOR.MINOR.PATCH
976
1260
  For example:
977
1261
 
978
1262
  ```text
979
- v0.1.0
1263
+ v0.2.0
980
1264
  ```
981
1265
 
982
1266
  The `0.x` versions indicate that the CLI and features may still change