Summary
hg Use ID
Shamir's secret sharing
Download as zip
Laman 7c94e9b021f6
5 years ago
Laman 3e09cfb12e3a
5 years ago
Laman 4cdad28c44d9
5 years ago
Laman 329ff9ed7905
5 years ago
Laman 37a1df17b9a1
5 years ago
Laman cc4182acd584
5 years ago
Laman ccb4a27318f1
5 years ago
Laman b52e197db5a8
7 years ago
Laman 735b9c2a61e9
7 years ago
Laman 6511b6f4f6c0
7 years ago

Shamira

Implements Shamir's secret sharing algorithm. Splits a string or a byte sequence byte-per-byte into n<255 shares, with any k of them sufficient for reconstruction of the original input.

Outputs the shares as hexadecimal, Base32 or Base64 encoded strings.

Installation

From pip

Run pip install shamira.

From the source

Can be run straight from the cloned repository by executing the package with python -m shamira or built with python -m build and installed with pip install dist/shamira*.whl.

Usage

As a CLI application

Run shamira split ... for splitting and shamira join ... for joining the shares back. Appending --help will show you the documentation.

As a library

from shamira import generate, generate_raw, reconstruct, reconstruct_raw

help(function) will show the documentation.

Issue tracker

Please report your issues to https://trac.19x19.cz/shamira/report

Performance

Being written in pure Python, the code is not especially fast. It is therefore recommended to split rather keys to encrypted files than the files themselves.

Benchmark results, as obtained by running shamira benchmark. All values mean seconds per byte of the secret length:

k / n parameters Split Join
2 / 3 (a Raspberry Pi 3) 0.000142 0.000448
2 / 3 (a laptop) 7.88e-06 4.28e-05
254 / 254 (a Raspberry Pi 3) 0.0268 0.0287
254 / 254 (a laptop) 0.00183 0.00156

License

The code is licensed under GNU GPL v3. If this doesn't fit your needs, reach me and we can negotiate relicensing.