From d4b74c18105630ca799a03b46ec5ba22eef03976 Mon Sep 17 00:00:00 2001 From: Daniel Langbein Date: Sun, 4 Sep 2022 21:07:40 +0200 Subject: [PATCH] more arguments; update README.md --- README.md | 10 ++++++---- setup.cfg | 2 +- src/paper_secret/enpaper.py | 7 +++++++ 3 files changed, 14 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 581663d..59a14b4 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,9 @@ Shamir Secret Sharing on paper using gfshare. ### Dependencies -`gfshare` is required to split and merge the secret. +Required and optional dependencies with example how to install them for Arch Linux. + +`gfshare` is required to split (`enpaper`) and merge (`depaper`) the secret. See `man gfshare` for an explanation of Shamir Secret Sharing in gf(2**8). ```shell @@ -18,14 +20,14 @@ sudo pacman -S --needed libgfshare ``` `qrencode` and `imagemagick` (`convert`) are required to create and merge QR-codes during the split process. -One can set the according parameters of `split_encode` to `False` to skip this step. +One can pass `-q` to `enpapaer` to skip this step. ```shell sudo pacman -S --needed qrencode imagemagick ``` `enscript` and `ghostscript` (`ps2pdf`) are required to create a PDF containing the split secret in text form. -One can set the according parameters of `split_encode` to `False` to skip this step. +One can pass `-t` to `enpaper` to skip this step. ```shell sudo pacman -S --needed enscript ghostscript @@ -33,7 +35,7 @@ sudo pacman -S --needed enscript ghostscript ## Usage -Create a secret: +Create a file with secret content: ```shell cat > secret.txt diff --git a/setup.cfg b/setup.cfg index 2c3f367..ffe0559 100644 --- a/setup.cfg +++ b/setup.cfg @@ -3,7 +3,7 @@ [metadata] name = paper-secret -version = 0.1.2 +version = 0.1.3 author = Daniel Langbein author_email = daniel@systemli.org description = Shamir Secret Sharing on paper using gfshare diff --git a/src/paper_secret/enpaper.py b/src/paper_secret/enpaper.py index 6227bd2..16b377b 100755 --- a/src/paper_secret/enpaper.py +++ b/src/paper_secret/enpaper.py @@ -16,10 +16,16 @@ def main(): action='store_false', default=True) parser.add_argument('--no-text-pdf', '-t', help='skip text-PDF generation', action='store_false', default=True) + parser.add_argument('--num-shares', '-n', help='number of shares to generate', + default=5, type=int) + parser.add_argument('--threshold', '-k', help='threshold for recombination', + default=3, type=int) # args = parser.parse_args() split_encode(secret=args.secret, + k=args.threshold, + n=args.num_shares, create_qr_codes=args.no_qr, create_text_pdf=args.no_text_pdf) @@ -47,6 +53,7 @@ def split_encode( :param n: Number of shares to generate :return: List of created files. """ + assert n > k assert secret.exists(), str(secret) assert secret.is_file(), str(secret)