more arguments; update README.md

This commit is contained in:
Daniel Langbein 2022-09-04 21:07:40 +02:00
parent e4f63e8971
commit d4b74c1810
3 changed files with 14 additions and 5 deletions

View File

@ -10,7 +10,9 @@ Shamir Secret Sharing on paper using gfshare.
### Dependencies ### 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). See `man gfshare` for an explanation of Shamir Secret Sharing in gf(2**8).
```shell ```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. `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 ```shell
sudo pacman -S --needed qrencode imagemagick sudo pacman -S --needed qrencode imagemagick
``` ```
`enscript` and `ghostscript` (`ps2pdf`) are required to create a PDF containing the split secret in text form. `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 ```shell
sudo pacman -S --needed enscript ghostscript sudo pacman -S --needed enscript ghostscript
@ -33,7 +35,7 @@ sudo pacman -S --needed enscript ghostscript
## Usage ## Usage
Create a secret: Create a file with secret content:
```shell ```shell
cat > secret.txt cat > secret.txt

View File

@ -3,7 +3,7 @@
[metadata] [metadata]
name = paper-secret name = paper-secret
version = 0.1.2 version = 0.1.3
author = Daniel Langbein author = Daniel Langbein
author_email = daniel@systemli.org author_email = daniel@systemli.org
description = Shamir Secret Sharing on paper using gfshare description = Shamir Secret Sharing on paper using gfshare

View File

@ -16,10 +16,16 @@ def main():
action='store_false', default=True) action='store_false', default=True)
parser.add_argument('--no-text-pdf', '-t', help='skip text-PDF generation', parser.add_argument('--no-text-pdf', '-t', help='skip text-PDF generation',
action='store_false', default=True) 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() args = parser.parse_args()
split_encode(secret=args.secret, split_encode(secret=args.secret,
k=args.threshold,
n=args.num_shares,
create_qr_codes=args.no_qr, create_qr_codes=args.no_qr,
create_text_pdf=args.no_text_pdf) create_text_pdf=args.no_text_pdf)
@ -47,6 +53,7 @@ def split_encode(
:param n: Number of shares to generate :param n: Number of shares to generate
:return: List of created files. :return: List of created files.
""" """
assert n > k
assert secret.exists(), str(secret) assert secret.exists(), str(secret)
assert secret.is_file(), str(secret) assert secret.is_file(), str(secret)