Fair and Sound Secret Sharing from Homomorphic Time-Lock Puzzles Based on: Jodie Knapp and Elizabeth A. Quaglia, IACR Cryptol. ePrint Arch. 2020, p. 1078
Gregory Morse — Eötvös Loránd University (ELTE), Budapest, Hungary Presented at the Cryptography Seminar, Fall Semester 2020, December 14, 2020
This repository accompanies a study of how prior research on Homomorphic Time-Lock Puzzles (HTLPs) can be incorporated into Secret Sharing schemes. This allows for the guarantee that a certain amount of elapsed time has occurred over some number of sharing rounds — determined by the dealer — based on well-established cryptographic security assumptions. A concrete implementation is given using the multiplicatively homomorphic variant (MHTLP), which was further implemented as a protocol simulation suite in Python and tested to obtain real-world performance measurements based on the security bit-size and the time-hardness parameter τ.
The paper under study contained several errors in the appendix which were discovered through careful implementation: an unused prime parameter, a potential information-loss issue from double reduction modulo p then N, a degree-off-by-one in the polynomial threshold, and a misuse of a product symbol in the outer sum of Lagrange interpolation.
mhtlpss/
└── mhtlpss.py # Full Python protocol simulation suite
A
Rational Secret Sharing (RSS) introduces game-theoretic fairness and soundness: a player is rational if they have a preference over outcomes. The protocol must achieve a computationally strict Nash equilibrium so that deviating from the prescribed strategy is never beneficial.
A TLP embeds a secret into a puzzle such that it cannot be decrypted until time
parameter
-
$Z \leftarrow PGen(\tau, s)$ — probabilistic puzzle generation -
$s \leftarrow PSolve(Z)$ — deterministic puzzle solving, requiring$\Omega(2^\tau)$ work
A Homomorphic TLP (HTLP) additionally supports evaluation of a function over encrypted puzzles without solving them first. This work uses the Multiplicative HTLP (MHTLP) from:
G. Malavolta and S. A. K. Thyagarajan. Homomorphic time-lock puzzles and applications. CRYPTO 2019, LNCS vol. 11692, pp. 620–649. Springer, 2019.
The MHTLP operates over the Jacobi subgroup
- Generate
$\lambda$ -bit RSA safe primes$p, q$ (i.e.$p = 2p' + 1$ ,$q = 2q' + 1$ where$p', q'$ are Sophie Germain primes) -
$N := p \cdot q$ ;$\phi(N) = (p-1)(q-1)$ - Sample
$\tilde{g}$ uniformly at random from$\mathbb{Z}_N^*$ ; set$g := -\tilde{g}^2 \bmod N$ so that$g \in \mathbb{J}_N$ - Compute
$h := g^{2^\tau \bmod \phi(N)/2} \bmod N$ - Output public parameters
$pp := (\tau, N, g, h)$
- Sample uniform
$r \leftarrow {1, \ldots, N^2}$ - Output puzzle
$Z := (u, v) = (g^r \bmod N,\ h^r \cdot s \bmod N)$
- Compute
$w := u^{2^\tau} \bmod N$ via sequential squaring (no totient shortcut available to solver) - Output
$s := v \cdot w^{-1} \bmod N$
- Compute
$\tilde{u} := \prod u_i \bmod N$ ,$\tilde{v} := \prod v_i \bmod N$ - Output combined puzzle
$(\tilde{u}, \tilde{v})$ - This reduces the number of sequential squarings required from
$n \cdot \tau$ to$\tau$
The protocol is a
The dealer
The dealer D generates a random secret
Real shares are computed as si = f(yi) mod N for
Each share si is split into
Each sub-share is wrapped in a time-lock puzzle:
Finally D broadcasts
In each round
- Combines the sub-puzzles homomorphically:
- Solves the combined puzzle to obtain
$s_k \leftarrow \mathrm{MHP.PSolve}(pp_1, \mathcal{Z}_k)$ . - Recovers
$f'(x)$ by Lagrange interpolation over$(y_1, s_1), \ldots, (y_k, s_k)$ . - Checks: if
$f'(y_0) \bmod N = s_0$ , outputs$s = f'(0)$ ; otherwise waits for the next round.
python3 mhtlpss.pyPrerequisites: Python 3.x, standard library only (uses random, timeit, functools).
Secret 177752076808708683724019157938862414660819843138117806454785143209647261648387
Secret recovered: 42992640874959428435985600054132028856757633984717618489627487864674394068400
Verification check: False
Secret recovered: 47882224558090490054864839956187730250673258445210066817503657188159850231087
Verification check: False
Secret recovered: 119675411572083612811154639174043756103610737852506437200371014482416860367104
Verification check: False
Secret recovered: 177752076808708683724019157938862414660819843138117806454785143209647261648387
Verification check: True
The secret is recovered only once the Lagrange interpolation has accumulated
enough real shares and the checking share
Benchmarks were collected with parameters
|
|
|
|
|
|
|---|---|---|---|---|
| 1,048,576 | 3.24 | 7.44 | 21.24 | 69.29 |
| 2,097,152 | 7.05 | 15.29 | 42.43 | 137.90 |
| 4,194,304 | 13.94 | 31.46 | 83.48 | 279.59 |
| 8,388,608 | 26.77 | 63.45 | 173.49 | 556.34 |
Observations:
- Run time scales linearly in
$\tau$ as expected (sequential squarings dominate) - Run time scales super-linearly in
$\lambda$ due to the quadratic cost of modular multiplication on large integers$\mathcal{O}(n^2)$ ; practically$\mathcal{O}(\lambda^2)$ - Prime generation time is excluded from measurements as it has high variance
A professional implementation in C/C++ using optimized modular arithmetic e.g.,
Karatsuba
The scheme's security rests on three standard hardness assumptions:
-
Strong RSA — Given strong RSA modulus
$N$ , it is hard to compute$e$ -th roots modulo$N$ for random prime$e$ . -
Sequential Squaring — Given generator
$g$ of$\mathbb{J}_N$ and time bound$\tau$ , no circuit of depth$< \tau^\epsilon$ (for some$0 < \epsilon < 1$ ) can distinguish$x^{2^\tau}$ from a random element of$\mathbb{J}_N$ with advantage non-negligibly greater than$\frac{1}{2}$ . -
Decisional Diffie-Hellman (DDH) over
$\mathbb{J}_N$ —$(g, g^x, g^y, g^{xy})$ is computationally indistinguishable from$(g, g^x, g^y, g^z)$ for random$z$ .
- The checking share
$s_0$ allows any player to test candidate secrets in each round, meaning$r-1$ shares may suffice if an external verification oracle exists. - If an adversary factors
$N$ (knowing$p, q$ ), the$2^\tau$ exponentiation shortcut used by the dealer becomes available, breaking the time-hardness guarantee. - The scheme is not post-quantum: security relies on the hardness of integer factoring, which Shor's algorithm breaks in polynomial time.
- A cryptographically secure PRNG (CSPRNG) must replace
randomin any real deployment.
During implementation, the following issues were identified in the appendix of the original paper (Knapp & Quaglia, 2020):
-
Unused prime
$p$ — Public parameters specified a prime$p > {s, n}$ (seemingly as the polynomial field) that was never referenced in the protocol. -
Double reduction —
$y = f(x) \bmod p \bmod N$ would cause information loss when$f(x) > p > N$ . -
Degree off by one — The protocol specified
$r$ shares to recover a polynomial of degree$r$ , which of course must be degree$r - 1$ . -
Wrong symbol — Lagrange interpolation used a product symbol
$\prod$ for the outer summation instead of$\sum$ .
The code builds on a subset of the Shamir's Secret Sharing Python example from Wikipedia (CC0 / OWFa licensed). The functions retained from that base are:
_extended_gcd(a, b)— extended Euclidean algorithm for modular inverse_eval_at(poly, x, prime)— Horner's method polynomial evaluation_divmod(num, den, p)— modular division via_extended_gcd
All cryptographic primitives (MHTLP setup, puzzle generation, solving, evaluation), the Miller-Rabin primality tester, safe prime generation, Jacobi symbol computation, Lagrange interpolation with full polynomial recovery, and the protocol simulation are original implementations written for this study.
- Knapp, J., Quaglia, E. A. (2020). Fair and Sound Secret Sharing from Homomorphic Time-Lock Puzzles. IACR Cryptol. ePrint Arch. 2020, p. 1078. https://eprint.iacr.org/2020/1078
- Malavolta, G., Thyagarajan, S. A. K. (2019). Homomorphic time-lock puzzles and applications. CRYPTO 2019, LNCS vol. 11692, pp. 620–649. Springer. https://eprint.iacr.org/2019/477
- Rivest, R. L., Shamir, A., Wagner, D. A. (1996). Time-lock puzzles and timed-release crypto. MIT/LCS/TR-684.
- Shamir, A. (1979). How to share a secret. Commun. ACM, 22(11), 612–613.
- Wikipedia contributors. Miller–Rabin primality test. https://en.wikipedia.org/wiki/Miller%E2%80%93Rabin_primality_test
- Wikipedia contributors. Jacobi symbol. https://en.wikipedia.org/wiki/Jacobi_symbol
- Wikipedia contributors. Safe and Sophie Germain primes. https://en.wikipedia.org/wiki/Safe_and_Sophie_Germain_primes
- Wikipedia contributors. Shamir's Secret Sharing — Python example. https://en.wikipedia.org/wiki/Shamir%27s_Secret_Sharing#Python_example
If you use or build upon this work, please cite:
@misc{morse2020mhtlpss,
author = {Gregory Morse},
title = {Fair and Sound Secret Sharing from Homomorphic Time-Lock Puzzles:
Python Protocol Simulation Suite},
year = {2020},
note = {Cryptography Seminar, Fall Semester 2020,
E\"{o}tv\"{o}s Lor\'{a}nd University (ELTE),
Budapest, Hungary. December 14, 2020},
url = {https://github.com/GregoryMorse/mhtlpss}
}MIT License. See LICENSE for details.
Gregory Morse — gregory.morse@live.com Eötvös Loránd University (ELTE), Budapest, Hungary