owenrusk.dev

tally

shamir's secret sharing over gf(256).

git clone https://owenrusk.dev/tally.git

commit 3a7c7f55b7b1f890f198418b9aff14cf03aaa15b
parent 8456f3446f1b13394de904dc22b6efddf56e1a5a
author Owen Rusk <owen@papermothgames.com>
date   2024-07-11 20:20:39 -0500
join: write the secret as raw bytes

decoding broke on anything that wasn't utf-8, and print added a newline that was never in the secret.
tally/cli.py+1-1
diff --git a/tally/cli.py b/tally/cli.py
index 2becc55..a77bee1 100644
--- a/tally/cli.py
+++ b/tally/cli.py
@@ -28,7 +28,7 @@ def cmd_join(args: argparse.Namespace) -> int:
     if len(shares) < k:
         raise ShareError(f"need {k} shares, got {len(shares)}")
     secret = shamir.combine([(s.x, s.data) for s in shares[:k]])
-    print(secret.decode())
+    sys.stdout.buffer.write(secret)
     return 0