From d2dae5faa08d175befe21e1a810f537f3146cb3f Mon Sep 17 00:00:00 2001 From: Daniel Langbein Date: Fri, 2 Sep 2022 12:30:46 +0200 Subject: [PATCH] add PyPi link --- README.md | 6 ++++++ create_script.py | 33 +++++++++++++++++++++++++++++++++ 2 files changed, 39 insertions(+) create mode 100755 create_script.py diff --git a/README.md b/README.md index 5abe4e3..b2660a1 100644 --- a/README.md +++ b/README.md @@ -4,6 +4,12 @@ Shamir Secret Sharing on paper using gfshare. ## Installation +### PyPi + +* https://pypi.org/project/paper-secret/ + +### Dependencies + `gfshare` is required to split and merge the secret. See `man gfshare` for an explanation of Shamir Secret Sharing in gf(2**8). diff --git a/create_script.py b/create_script.py new file mode 100755 index 0000000..d1a1979 --- /dev/null +++ b/create_script.py @@ -0,0 +1,33 @@ +#!/usr/bin/env python3 +# -*- coding: utf-8 -*- +from pathlib import Path + + +def main(): + """ + Creates two single-file python executables `enpaper` and `depaper`. + + One can use this method as an alternative to an installation from PyPi. + """ + package = Path() / 'src' / 'paper_secret' + util = package / 'util.py' + + enpaper_files = [util, package / 'enpaper.py'] + depaper_files = [util, package / 'depaper.py'] + + create_script(enpaper_files, Path('enpaper')) + create_script(depaper_files, Path('depaper')) + + +def create_script(files: list[Path], dst: Path): + text = '\n'.join([file.read_text() for file in files]) + + text = text.replace('import paper_secret.util as util', '') + text = text.replace('util.execute_stdin_capture', 'execute_stdin_capture') + + dst.write_text(text) + dst.chmod(0o755) + + +if __name__ == '__main__': + main()