Changeset - 8cbbc92dd17c
[Not reviewed]
default
0 1 1
Laman - 4 years ago 2020-12-18 12:00:38

updated measurements for a new machine
2 files changed with 31 insertions and 4 deletions:
0 comments (0 inline, 0 general)
performance.md
Show inline comments
 
new file 100644
 
# Performance comparison #
 
## The base case ##
 

	
 
Let's assume we have a secret of length _m_. The splitting takes _n_ evaluations of a polynomial of order _k_ (over Galois field 256) for each byte, leading to _O(n\*k\*m)_ finite field multiplications. Reconstruction of the constant parameters during joining first precomputes parts of the Lagrange polynomial and then reuses them for each byte, taking _O(k\*k + k\*m)_ multiplications.
 

	
 
Benchmark results. The times for split and join mean _seconds per byte_ of the secret length:
 
<table>
 
    <tr>
 
        <th>Revision</th>
 
        <th>Features</th>
 
        <th>k / n parameters</th>
 
        <th>Split</th>
 
        <th>Join</th>
 
    </tr>
 
    <tr>
 
        <td rowspan="2">a47ae3e113cc</td>
 
        <td rowspan="2">-</td>
 
        <td>2 / 3</td>
 
        <td>5.02e-06</td>
 
        <td>4.12e-05</td>
 
    </tr>
 
    <tr>
 
        <td>254 / 254</td>
 
        <td>0.0125</td>
 
        <td>0.00175</td>
 
    </tr>
 
</table>
 
\ No newline at end of file
readme.md
Show inline comments
 
@@ -5,40 +5,40 @@ Implements [Shamir's secret sharing algo
 
Outputs the shares as hexadecimal, Base32 or Base64 encoded strings.
 

	
 
## Installation and usage ##
 

	
 
Can be run straight from the cloned repository by executing the package with `python -m shamira` or simply installed with `python setup.py build`, `python setup.py install`. Then imported in your code with `import shamira` or run from the command line with `shamira`.
 

	
 
## Performance ##
 

	
 
As it is, the code is not very fast. Let's assume we have a secret of length _m_. For each byte, the splitting takes _n_ evaluations of a polynomial of order _k_ over Galois field 256, leading to _O(n\*k\*m)_ finite field multiplications. Reconstruction of the constant parameters during joining takes _O(k\*k + k\*m)_ multiplications.
 

	
 
Benchmark results, all values mean _seconds per byte_ of the secret length:
 
<table>
 
    <tr>
 
        <th>k / n parameters</th>
 
        <th>Split</th>
 
        <th>Join</th>
 
    </tr>
 
    <tr>
 
        <td>2 / 3 (a Raspberry Pi 3)</td>
 
        <td>6.08e-05</td>
 
        <td>0.000435</td>
 
    </tr>
 
    <tr>
 
        <td>2 / 3 (a laptop)</td>
 
        <td>8.7e-06</td>
 
        <td>7.17e-05</td>
 
        <td>5.02e-06</td>
 
        <td>4.12e-05</td>
 
    </tr>
 
    <tr>
 
        <td>254 / 254 (a Raspberry Pi 3)</td>
 
        <td>0.226</td>
 
        <td>0.0314</td>
 
    </tr>
 
    <tr>
 
        <td>254 / 254 (a laptop)</td>
 
        <td>0.0209</td>
 
        <td>0.00347</td>
 
        <td>0.0125</td>
 
        <td>0.00175</td>
 
    </tr>
 
</table>
 

	
 
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 `shamira benchmark`
0 comments (0 inline, 0 general)