summaryrefslogtreecommitdiffhomepage
path: root/Crypto/SecretSharing.hs
blob: a2a4f07a8463935c9b81ee05154134070a3d062e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
-----------------------------------------------------------------------------
-- |
-- Module      :  Crypto.SecretSharing
-- Copyright   :  Peter Robinson 2014
-- License     :  LGPL
-- 
-- Maintainer  :  Peter Robinson <peter.robinson@monoid.at>
-- Stability   :  experimental
-- Portability :  portable
-- 
-- Implementation of an (@m@,@n@)-threshold secret sharing scheme.
-- A given ByteString @b@ (the secret) is split into @n@ shares, 
-- and any @m@ shares are sufficient to reconstruct @b@.
-- The scheme preserves perfect secrecy in the sense that the knowledge of up
-- to @m-1@ shares does not reveal any information about the secret @b@.
--
-- Typically, there are @n@ parties and we would like to give the @i@-th party
-- the @i@-share of each byte. 
-- For example, to encode a bytestring @secret@ as @10@ shares, any @5@ of which
-- are sufficient for reconstruction we could write:
--
-- > shares <- encode 5 10 secret
--
-- Note that each byte is encoded separately using a fresh set of random
-- coefficients.
--
-- The mathematics behind the secret sharing scheme is described in:
-- \"How to share a secret.\" by Shamir, Adi.
-- In Communications of the ACM 22 (11): 612–613, 1979.
-- 
--
-----------------------------------------------------------------------------

module Crypto.SecretSharing( encode, decode, Share )
where
import Crypto.SecretSharing.Internal