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)