zora-cli 0.1.4__tar.gz → 0.2.1__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.1
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.1`)**
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,125 @@ 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.1.2
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
+ > `@@` → literal `@`
398
+
399
+ | Preset | Characters |
400
+ | ---------- | ----------------------- |
401
+ | `@digits` | `0-9` |
402
+ | `@letters` | `a-zA-Z` |
403
+ | `@lower` | `a-z` |
404
+ | `@upper` | `A-Z` |
405
+ | `@special` | Punctuation and symbols |
406
+
407
+ ## Numeric
344
408
 
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 |
409
+ | Preset | Characters |
410
+ | --------- | ------------------------ |
411
+ | `@bin` | `01` |
412
+ | `@oct` | `01234567` |
413
+ | `@hex` | `0123456789ABCDEF` |
414
+ | `@lhex` | `0123456789abcdef` |
415
+ | `@allhex` | `0123456789ABCDEFabcdef` |
416
+
417
+ ## URL / filename friendly
418
+
419
+ | Preset | Characters |
420
+ | ----------- | -------------------------------- |
421
+ | `@url` | URL-friendly characters |
422
+ | `@urlsafe` | URL-safe alphanumeric characters |
423
+ | `@filename` | Filename-safe characters |
424
+
425
+ ## Human-friendly
426
+
427
+ These presets avoid characters that can easily be confused with one another.
428
+
429
+ | Preset | Description |
430
+ | ------------- | ----------------------------- |
431
+ | `@lowersafe` | Lowercase without `l` |
432
+ | `@uppersafe` | Uppercase without `I` and `O` |
433
+ | `@digitssafe` | Digits without `0` and `1` |
434
+
435
+ ## Base encodings
436
+
437
+ | Preset | Description |
438
+ | ---------- | ------------------------- |
439
+ | `@base32` | Uppercase Base32 alphabet |
440
+ | `@base32x` | Lowercase Base32 alphabet |
441
+ | `@base36` | Uppercase Base36 alphabet |
442
+ | `@base36x` | Lowercase Base36 alphabet |
443
+ | `@base62` | Base62 alphabet |
444
+
445
+ ## Base64
446
+
447
+ | Preset | Description |
448
+ | ------------ | ------------------------ |
449
+ | `@base64` | Standard Base64 alphabet |
450
+ | `@base64url` | URL-safe Base64 alphabet |
451
+
452
+ ## Symbols
453
+
454
+ | Preset | Characters |
455
+ | ----------- | --------------------------- |
456
+ | `@symbols` | Punctuation and symbols |
457
+ | `@brackets` | `()[]{}<>` |
458
+ | `@quotes` | Quote characters |
459
+ | `@math` | Common mathematical symbols |
355
460
 
356
461
  ---
357
462
 
@@ -365,7 +470,7 @@ zora 32 --charset @letters@digits
365
470
 
366
471
  This creates an alphanumeric character set.
367
472
 
368
- Multiple presets can be combined:
473
+ Multiple presets can also be combined:
369
474
 
370
475
  ```bash
371
476
  zora 32 --charset @upper@lower@digits
@@ -381,6 +486,12 @@ For example:
381
486
 
382
487
  does not contain uppercase characters twice.
383
488
 
489
+ The short `-x` form can be used as well:
490
+
491
+ ```bash
492
+ zora 32 -x @upper@lower@digits
493
+ ```
494
+
384
495
  ---
385
496
 
386
497
  ## Custom characters
@@ -411,44 +522,43 @@ means:
411
522
  X + Y + Z + @hex
412
523
  ```
413
524
 
414
- This allows arbitrary character sets without needing to add a new preset.
525
+ This allows arbitrary character sets without requiring a new preset.
415
526
 
416
527
  ---
417
528
 
418
- # `--charset-list`
529
+ ## `--charset-list`
419
530
 
420
- Display the available charset presets:
531
+ Display all available charset presets:
421
532
 
422
533
  ```bash
423
534
  zora --charset-list
424
535
  ```
425
536
 
537
+ The output includes the preset name and its characters.
538
+
426
539
  Example:
427
540
 
428
541
  ```text
429
542
  Available charsets:
430
-
431
- @digits
432
- @letters
433
- @lower
434
- @upper
435
- @hex
436
- @oct
437
- @bin
438
- @special
543
+ @digits = 0123456789
544
+ @letters = abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ
545
+ @lower = abcdefghijklmnopqrstuvwxyz
546
+ @upper = ABCDEFGHIJKLMNOPQRSTUVWXYZ
547
+ ...
439
548
 
440
549
  Use as:
441
-
442
550
  zora --charset @digits
443
551
  zora --charset @letters@digits
444
552
  zora --charset @hexXYZ
445
553
  ```
446
554
 
555
+ This mode exits immediately after displaying the available presets.
556
+
447
557
  ---
448
558
 
449
559
  # Multiple keys
450
560
 
451
- Use `-n` or `--count`:
561
+ Use `-n` or `--count` to generate multiple keys:
452
562
 
453
563
  ```bash
454
564
  zora 32 --count 10
@@ -460,7 +570,7 @@ or:
460
570
  zora 32 -n 10
461
571
  ```
462
572
 
463
- Zora generates each key independently.
573
+ Each key is generated independently.
464
574
 
465
575
  When using the secure default generator, each key is generated using the
466
576
  cryptographically secure random generator.
@@ -537,24 +647,96 @@ entropy.
537
647
 
538
648
  ---
539
649
 
650
+ # Output formats
651
+
652
+ Zora supports multiple output formats through `--format`.
653
+
654
+ Available formats:
655
+
656
+ * `text`
657
+ * `json`
658
+ * `csv`
659
+ * `xml`
660
+ * `yml`
661
+
662
+ The default format is `text`.
663
+
664
+ ## Text
665
+
666
+ ```bash
667
+ zora 32 --format text
668
+ ```
669
+
670
+ This is the default output format.
671
+
672
+ ## JSON
673
+
674
+ ```bash
675
+ zora 32 -n 3 --format json
676
+ ```
677
+
678
+ Example:
679
+
680
+ ```json
681
+ {
682
+ "keys": [
683
+ "GxKqTnJpYwRzLhBcVfQmNsXeUaPkTdWr",
684
+ "...",
685
+ "..."
686
+ ]
687
+ }
688
+ ```
689
+
690
+ ## CSV
691
+
692
+ ```bash
693
+ zora 32 -n 3 --format csv
694
+ ```
695
+
696
+ The generated CSV contains a `key` column.
697
+
698
+ ## XML
699
+
700
+ ```bash
701
+ zora 32 -n 3 --format xml
702
+ ```
703
+
704
+ ## YAML
705
+
706
+ ```bash
707
+ zora 32 -n 3 --format yml
708
+ ```
709
+
710
+ YAML output requires PyYAML:
711
+
712
+ ```bash
713
+ pip install pyyaml
714
+ ```
715
+
716
+ ---
717
+
540
718
  # File output
541
719
 
542
- Use `-o` or `--output` to write generated keys to a file:
720
+ Use `-o` or `--output` to write generated output to a file:
543
721
 
544
722
  ```bash
545
723
  zora 32 -n 10 --output keys.txt
546
724
  ```
547
725
 
548
- The generated keys are written one per line.
726
+ The output format can be selected independently:
549
727
 
550
- Example:
728
+ ```bash
729
+ zora 32 -n 10 --format json -o keys.json
730
+ ```
551
731
 
552
- ```text
553
- GxKqTnJpYwRzLhBcVfQmNsXeUaPkTdWr
554
- aQmXzPjLtVrNsYkBcWdHgFqAeUxRoZiLp
555
- ...
732
+ ```bash
733
+ zora 32 -n 10 --format csv -o keys.csv
556
734
  ```
557
735
 
736
+ Generated files use UTF-8 encoding.
737
+
738
+ Text-based CLI output uses a conventional final newline.
739
+
558
740
  ---
559
741
 
560
742
  # Secure generation
@@ -644,6 +826,45 @@ rather than being reseeded for every key.
644
826
 
645
827
  ---
646
828
 
829
+ # Benchmarking
830
+
831
+ Use `--benchmark` to benchmark key generation:
832
+
833
+ ```bash
834
+ zora 32 --benchmark
835
+ ```
836
+
837
+ The benchmark reports:
838
+
839
+ * Generator
840
+ * Key length
841
+ * Number of keys
842
+ * Charset size
843
+ * Total characters generated
844
+ * Keys per second
845
+ * Characters per second
846
+
847
+ Example:
848
+
849
+ ```text
850
+ Zora Benchmark
851
+ ────────────────────────────────
852
+ Generator: CSPRNG
853
+ Length: 32
854
+ Count: 1
855
+ Charset: 52
856
+ Characters: 32
857
+ Keys/sec: ...
858
+ Characters/sec: ...
859
+ ```
860
+
861
+ Benchmarking does not produce normal key output.
862
+
863
+ The benchmark respects `--unsafe`, `--seed`, `--count`, and the selected
864
+ charset.
865
+
866
+ ---
867
+
647
868
  # Quiet mode
648
869
 
649
870
  Use `-q` or `--quiet` to suppress non-essential output:
@@ -660,25 +881,31 @@ For example:
660
881
  zora 32 --quiet > key.txt
661
882
  ```
662
883
 
884
+ Quiet mode suppresses the timer, entropy, strength, generator information,
885
+ and update notification.
886
+
663
887
  ---
664
888
 
665
889
  # Entropy
666
890
 
667
- Zora calculates the theoretical entropy of the random portion of the
668
- key.
891
+ Zora calculates the theoretical entropy of the random portion of the key.
669
892
 
670
893
  The formula is:
671
894
 
672
- $entropy = length \times \log{_2}{(charset size)}$
895
+ ```text
896
+ entropy = length × log₂(charset size)
897
+ ```
673
898
 
674
899
  For example, using 52 possible characters:
675
900
 
676
- $32 \times log{_2}\space 52$
901
+ ```text
902
+ 32 × log₂(52)
903
+ ```
677
904
 
678
905
  produces approximately:
679
906
 
680
907
  ```text
681
- 182.17 bits
908
+ 182.41 bits
682
909
  ```
683
910
 
684
911
  The entropy calculation only considers random characters.
@@ -733,6 +960,25 @@ PRNG
733
960
 
734
961
  ---
735
962
 
963
+ # Argument validation
964
+
965
+ Zora validates command-line arguments before generating keys.
966
+
967
+ Examples of invalid arguments include:
968
+
969
+ * A key length of `0` or less
970
+ * A key length missing when generation is requested
971
+ * A `--group` value greater than the key length
972
+ * Using `--seed` without `--unsafe`
973
+ * An unknown charset preset
974
+ * An empty final charset
975
+ * A charset containing fewer than two unique characters
976
+
977
+ Invalid arguments result in a clear command-line error instead of
978
+ attempting to generate invalid output.
979
+
980
+ ---
981
+
736
982
  # Example commands
737
983
 
738
984
  ### Basic key
@@ -744,49 +990,55 @@ zora 32
744
990
  ### Digits only
745
991
 
746
992
  ```bash
747
- zora 32 --charset @digits
993
+ zora 32 -x @digits
748
994
  ```
749
995
 
750
996
  ### Lowercase only
751
997
 
752
998
  ```bash
753
- zora 32 --charset @lower
999
+ zora 32 -x @lower
754
1000
  ```
755
1001
 
756
1002
  ### Uppercase only
757
1003
 
758
1004
  ```bash
759
- zora 32 --charset @upper
1005
+ zora 32 -x @upper
760
1006
  ```
761
1007
 
762
1008
  ### Alphanumeric
763
1009
 
764
1010
  ```bash
765
- zora 32 --charset @letters@digits
1011
+ zora 32 -x @letters@digits
766
1012
  ```
767
1013
 
768
1014
  ### Hexadecimal
769
1015
 
770
1016
  ```bash
771
- zora 32 --charset @hex
1017
+ zora 32 -x @hex
772
1018
  ```
773
1019
 
774
1020
  ### Hexadecimal plus custom characters
775
1021
 
776
1022
  ```bash
777
- zora 32 --charset @hexXYZ
1023
+ zora 32 -x @hexXYZ
778
1024
  ```
779
1025
 
780
1026
  ### Uppercase, lowercase and digits
781
1027
 
782
1028
  ```bash
783
- zora 32 --charset @upper@lower@digits
1029
+ zora 32 -x @upper@lower@digits
1030
+ ```
1031
+
1032
+ ### Human-friendly digits
1033
+
1034
+ ```bash
1035
+ zora 32 -x @digitssafe
784
1036
  ```
785
1037
 
786
1038
  ### Symbols
787
1039
 
788
1040
  ```bash
789
- zora 32 --charset @special
1041
+ zora 32 -x @symbols
790
1042
  ```
791
1043
 
792
1044
  ### Group the output
@@ -813,6 +1065,30 @@ zora 32 -n 10
813
1065
  zora 32 -n 100 -o keys.txt
814
1066
  ```
815
1067
 
1068
+ ### JSON output
1069
+
1070
+ ```bash
1071
+ zora 32 -n 10 --format json
1072
+ ```
1073
+
1074
+ ### Benchmark
1075
+
1076
+ ```bash
1077
+ zora 32 --benchmark
1078
+ ```
1079
+
1080
+ ### Show available charsets
1081
+
1082
+ ```bash
1083
+ zora --charset-list
1084
+ ```
1085
+
1086
+ ### Show version
1087
+
1088
+ ```bash
1089
+ zora --version
1090
+ ```
1091
+
816
1092
  ### Prefix
817
1093
 
818
1094
  ```bash
@@ -894,7 +1170,9 @@ random output space.
894
1170
  For example, a 32-character key selected uniformly from 62 possible
895
1171
  characters has:
896
1172
 
897
- $32 \times log{_2}\space 62$
1173
+ ```text
1174
+ 32 × log₂(62)
1175
+ ```
898
1176
 
899
1177
  bits of theoretical entropy.
900
1178
 
@@ -915,8 +1193,8 @@ The generator is nevertheless explicitly marked:
915
1193
  Generator: PRNG
916
1194
  ```
917
1195
 
918
- and the entropy/strength display is visually marked when `--unsafe` is
919
- used.
1196
+ and the entropy and strength display is visually marked when `--unsafe`
1197
+ is used.
920
1198
 
921
1199
  ---
922
1200
 
@@ -941,6 +1219,12 @@ Run:
941
1219
  zora 32
942
1220
  ```
943
1221
 
1222
+ For YAML output, install PyYAML:
1223
+
1224
+ ```bash
1225
+ pip install pyyaml
1226
+ ```
1227
+
944
1228
  ---
945
1229
 
946
1230
  # Roadmap
@@ -951,12 +1235,14 @@ Possible future improvements include:
951
1235
  * [x] Improved documentation
952
1236
  * [x] Installation through `pip`
953
1237
  * [x] Packaging with `pyproject.toml`
954
- * [ ] Automated test suite
955
- * [ ] Better charset parsing errors
1238
+ * [x] Better charset parsing errors
1239
+ * [x] Multiple output formats
1240
+ * [x] Benchmarking mode
1241
+ * [x] Version information
1242
+ * [x] Argument validation
1243
+ * [x] Automated test suite
956
1244
  * [ ] Configuration files
957
1245
  * [ ] Shell completion
958
- * [ ] More output formats
959
- * [ ] Benchmarking mode
960
1246
  * [ ] Cross-platform terminal improvements
961
1247
  * [ ] API/library usage
962
1248
  * [ ] More extensive security testing
@@ -976,7 +1262,7 @@ MAJOR.MINOR.PATCH
976
1262
  For example:
977
1263
 
978
1264
  ```text
979
- v0.1.0
1265
+ v0.1.3
980
1266
  ```
981
1267
 
982
1268
  The `0.x` versions indicate that the CLI and features may still change