Shamir Secret Sharing Calculator
Enter a secret, share count, threshold and prime to generate shares.
Result
How it is calculated
The secret S becomes the constant term of a polynomial of degree k−1: f(x) = S + a1x + … + ak−1xk−1 (mod p). Share number i is the pair (i, f(i)), for i = 1 … n, and any k shares determine the polynomial and so recover S = f(0). Here p is the prime modulus, and the secret must be a whole number from 0 up to p−1.
Unlike a real implementation, the coefficients are not random: each ai is computed from a CRC-32 checksum of the text “seed#i” taken mod p, so the same inputs and seed always give the same shares. This makes the output repeatable, which suits learning and checking by hand, but it is not secure. All numbers must be whole and no larger than about 3 billion. The threshold must be at least 2 and no larger than the share count, the share count must be between 1 and 1,000 and smaller than p, and p must be prime. Any input that breaks these rules shows no result.
Worked example
Secret S = 1234, n = 4 shares, threshold k = 3, prime p = 7919, seed “demo”. The seed gives a1 = 6415 and a2 = 1485, so f(x) = 1234 + 6415x + 1485x² (mod 7919). f(1) = 9134 − 7919 = 1215. f(2) = 20004 − 2×7919 = 4166. f(3) = 33844 − 4×7919 = 2168. f(4) = 50654 − 6×7919 = 3140. The tool lists the shares as:
1: 1215
2: 4166
3: 2168
4: 3140
Any three of them can be combined by Lagrange interpolation to get 1234 back.
Common mistakes
- Using the shares as a real secret split. The coefficients come from a public checksum of the seed, so anyone who knows the seed (the default is “demo”) can rebuild the polynomial and even one share would then reveal the secret. Use it to learn the method only.
- Choosing a modulus that is not prime, such as 7920. The tool rejects it, because division in the recovery step needs a prime field.
- Entering a secret equal to or larger than the modulus. The secret must be below p, so a 4-digit secret needs a prime above 9999.
- Making the share count as large as the modulus. Shares are numbered 1 … n and those numbers must be distinct non-zero residues mod p, so n has to be smaller than p; with p = 7, asking for 7 shares shows no result.
- Setting the threshold to 1 or above the number of shares. Thresholds below 2 give no result, and a threshold above n could never be met.
About this calculator
Introduced by cryptographer Adi Shamir in 1979, Shamir's Secret Sharing splits a secret into n shares so that any k of them reconstruct it exactly, while — when implemented properly — any k−1 or fewer reveal absolutely nothing about it (information-theoretic, not just computational, security). It works by building a polynomial of degree k−1 whose constant term is the secret, with the other coefficients chosen at random, then handing each participant one point (x, f(x)) on that polynomial, evaluated over a finite field defined by a prime modulus.
Recovery uses Lagrange interpolation: any k of the distributed points uniquely determine the degree-(k−1) polynomial, and evaluating it at x = 0 returns the original secret. This threshold scheme underlies real key-management systems — HashiCorp Vault's unseal keys and wallet-recovery standards like SLIP-0039 use it so that no single key holder, and no small subset of them, can reconstruct a master secret alone. This calculator is a learning demonstration: the other coefficients come from a seed text rather than true randomness, so the same inputs always give the same shares. Do not use it to protect real secrets.
Was this helpful?
You can pick up to 3 reactions.
Popular calculators
Loan Calculator
Monthly payment, total interest and full amortization schedule.
Percentage Calculator
Percent change, percent of, and ratio calculations.
Discount Calculator
Calculate final price, savings, and discount amount.
BMI Calculator
Body mass index from height and weight (metric or imperial).
Age Calculator
Compute your exact age in years, months and days from a birth date.
Compound Interest Calculator
Calculate the final amount and interest earned with compounding.
All Calculators
- Loan Calculator
- Profit Calculator
- Discount Calculator
- BMI Calculator
- Percentage Calculator
- Ideal Weight Calculator
- Age Calculator
- Pregnancy Due Date Calculator
- Compound Interest Calculator
- BMR Calculator (Basal Metabolic Rate)
- Tip Calculator
- Fuel Cost Calculator
- Date Difference Calculator
- Sleep Cycle Calculator
- Daily Water Intake Calculator
- Simple Interest Calculator
- Heart Rate Zones Calculator
- Running Pace Calculator
- Pet Age Calculator
- Calories Burned Calculator
- Macro Calculator
- TDEE Calculator (Total Daily Energy Expenditure)
- Waist-to-Hip Ratio Calculator
- Honor Roll Calculator
- One Rep Max (1RM) Calculator
- Ovulation Calculator
- Electricity Cost Calculator
- Unit Price Calculator
- Savings Goal Calculator
- Break-Even Point Calculator
- Paint Calculator
- Course Grade Average Calculator
- Business Days Calculator
- Time Duration Calculator
- Fuel Economy Calculator
- Temperature Converter
- Tile Calculator
- Aspect Ratio Calculator
- Roman Numeral Converter
- Goal Weight Timeline Calculator
- Salary Converter (Hourly to Annual)
- Credit Card Validator (Luhn)
- Body Surface Area (BSA) Calculator
- Feels-Like Temperature Calculator
- Ohm’s Law Calculator
- PPI (Pixel Density) Calculator
- Molar Mass Calculator
- Zodiac Sign Calculator (Western + Chinese)
- IBAN Validator
- Shoe Size Converter
- Country Info & Dialing Code Lookup
- Time Zone Difference (World Clock)
- CAGR (Compound Annual Growth Rate) Calculator
- Rule of 72 Calculator
- Blood Alcohol Content (BAC) Calculator
- Lean Body Mass (LBM) Calculator
- Pythagorean Theorem Calculator
- Speed Converter
- Download Time Calculator
- Date Calculator (Add/Subtract)
No calculators found
Comments