diff --git a/readme.md b/readme.md --- a/readme.md +++ b/readme.md @@ -1,7 +1,42 @@ # 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. +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. -Can be used on its own from the command line by invoking shamira.py or as a library by importing shamira.py. +Can be used on its own from the command line by invoking `shamira.py` or as a library by importing `shamira.py`. + +## Performance ## + +As it is, the code is not very fast. Splitting takes _n_ evaluations of a polynomial of order _k_ over Galois field 256, leading to _O(n*k)_ finite field multiplications. Reconstruction of the constant parameters during joining similarly takes _O(k*k)_ multiplications. + +Benchmark results, all values mean _seconds per byte_ of the secret length: + + + + + + + + + + + + + + + + + + + + + + + + + + +
k / n parametersSplitJoin
2 / 3 (a Raspberry Pi 3)7.99e-050.000428
2 / 3 (a laptop)1e-056.7e-05
254 / 254 (a Raspberry Pi 3)0.4170.471
254 / 254 (a laptop)0.04310.0542
+ +While the speeds are not awful, for longer secrets I recommend encrypting them with a random key of your choice and splitting only the key. Anyway, you can run your own benchmark with `benchmark.py`