secret-sharing-1.0.1.2: Information-theoretic secure secret sharing
CopyrightPeter Robinson 2014
LicenseLGPL
Stabilityexperimental
Portabilityportable
Safe HaskellNone
LanguageHaskell2010

Crypto.SecretSharing.Internal

Description

 
Synopsis

Documentation

polyInterp :: Fractional a => [(a, a)] -> a -> a Source #

Evaluate a Lagrange interpolation polynomial passing through the specified set of points.

slidingFocus :: [a] -> [([a], a, [a])] Source #

data ByteShare Source #

A share of an encoded byte.

Constructors

ByteShare 

Fields

  • shareId :: !Int

    the index of this share

  • reconstructionThreshold :: !Int

    number of shares required for reconstruction

  • shareValue :: !Int

    the value of p(shareId) where p(x) is the generated (secret) polynomial

Instances

Instances details
Eq ByteShare Source # 
Instance details

Defined in Crypto.SecretSharing.Internal

Methods

(==) :: ByteShare -> ByteShare -> Bool

(/=) :: ByteShare -> ByteShare -> Bool

Show ByteShare Source # 
Instance details

Defined in Crypto.SecretSharing.Internal

Methods

showsPrec :: Int -> ByteShare -> ShowS

show :: ByteShare -> String

showList :: [ByteShare] -> ShowS

Generic ByteShare Source # 
Instance details

Defined in Crypto.SecretSharing.Internal

Associated Types

type Rep ByteShare :: Type -> Type

Methods

from :: ByteShare -> Rep ByteShare x

to :: Rep ByteShare x -> ByteShare

Binary ByteShare Source # 
Instance details

Defined in Crypto.SecretSharing.Internal

Methods

put :: ByteShare -> Put

get :: Get ByteShare

putList :: [ByteShare] -> Put

type Rep ByteShare Source # 
Instance details

Defined in Crypto.SecretSharing.Internal

type Rep ByteShare = D1 ('MetaData "ByteShare" "Crypto.SecretSharing.Internal" "secret-sharing-1.0.1.2-EpWstegp4MSHE4WyhxsNf9" 'False) (C1 ('MetaCons "ByteShare" 'PrefixI 'True) (S1 ('MetaSel ('Just "shareId") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Int) :*: (S1 ('MetaSel ('Just "reconstructionThreshold") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Int) :*: S1 ('MetaSel ('Just "shareValue") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Int))))

data Share Source #

A share of the encoded secret.

Constructors

Share 

Fields

Instances

Instances details
Eq Share Source # 
Instance details

Defined in Crypto.SecretSharing.Internal

Methods

(==) :: Share -> Share -> Bool

(/=) :: Share -> Share -> Bool

Show Share Source # 
Instance details

Defined in Crypto.SecretSharing.Internal

Methods

showsPrec :: Int -> Share -> ShowS

show :: Share -> String

showList :: [Share] -> ShowS

Generic Share Source # 
Instance details

Defined in Crypto.SecretSharing.Internal

Associated Types

type Rep Share :: Type -> Type

Methods

from :: Share -> Rep Share x

to :: Rep Share x -> Share

Binary Share Source # 
Instance details

Defined in Crypto.SecretSharing.Internal

Methods

put :: Share -> Put

get :: Get Share

putList :: [Share] -> Put

type Rep Share Source # 
Instance details

Defined in Crypto.SecretSharing.Internal

type Rep Share = D1 ('MetaData "Share" "Crypto.SecretSharing.Internal" "secret-sharing-1.0.1.2-EpWstegp4MSHE4WyhxsNf9" 'False) (C1 ('MetaCons "Share" 'PrefixI 'True) (S1 ('MetaSel ('Just "theShare") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 [ByteShare])))

encode Source #

Arguments

:: Int

m

-> Int

n

-> ByteString

the secret that we want to share

-> IO [Share] 

Encodes a ByteString as a list of n shares, m of which are required for reconstruction. Lives in the IO to access a random source.

decode Source #

Arguments

:: [Share]

list of at least m shares

-> ByteString

reconstructed secret

Reconstructs a (secret) bytestring from a list of (at least m) shares. Throws AssertionFailed if the number of shares is too small.

encodeByte :: Int -> Int -> Polyn -> FField -> Vector ByteShare Source #

groupInto :: Int -> [a] -> [[a]] Source #

Groups a list into blocks of certain size. Running time: O(n)

newtype FField Source #

A finite prime field. All computations are performed in this field.

Constructors

FField 

Fields

Instances

Instances details
Eq FField Source # 
Instance details

Defined in Crypto.SecretSharing.Internal

Methods

(==) :: FField -> FField -> Bool

(/=) :: FField -> FField -> Bool

Fractional FField Source # 
Instance details

Defined in Crypto.SecretSharing.Internal

Methods

(/) :: FField -> FField -> FField

recip :: FField -> FField

fromRational :: Rational -> FField

Num FField Source # 
Instance details

Defined in Crypto.SecretSharing.Internal

Ord FField Source # 
Instance details

Defined in Crypto.SecretSharing.Internal

Methods

compare :: FField -> FField -> Ordering

(<) :: FField -> FField -> Bool

(<=) :: FField -> FField -> Bool

(>) :: FField -> FField -> Bool

(>=) :: FField -> FField -> Bool

max :: FField -> FField -> FField

min :: FField -> FField -> FField

Read FField Source # 
Instance details

Defined in Crypto.SecretSharing.Internal

Methods

readsPrec :: Int -> ReadS FField

readList :: ReadS [FField]

readPrec :: ReadPrec FField

readListPrec :: ReadPrec [FField]

Show FField Source # 
Instance details

Defined in Crypto.SecretSharing.Internal

Methods

showsPrec :: Int -> FField -> ShowS

show :: FField -> String

showList :: [FField] -> ShowS

Generic FField Source # 
Instance details

Defined in Crypto.SecretSharing.Internal

Associated Types

type Rep FField :: Type -> Type

Methods

from :: FField -> Rep FField x

to :: Rep FField x -> FField

FiniteField FField Source # 
Instance details

Defined in Crypto.SecretSharing.Internal

Methods

order :: FField -> Integer Source #

char :: FField -> Integer Source #

pthRoot :: FField -> FField Source #

allValues :: [FField] Source #

type Rep FField Source # 
Instance details

Defined in Crypto.SecretSharing.Internal

type Rep FField = D1 ('MetaData "FField" "Crypto.SecretSharing.Internal" "secret-sharing-1.0.1.2-EpWstegp4MSHE4WyhxsNf9" 'True) (C1 ('MetaCons "FField" 'PrefixI 'True) (S1 ('MetaSel ('Just "number") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (PrimeField 1021))))

prime :: Int Source #

The size of the finite field

type Polyn = [FField] Source #

A polynomial over the finite field given as a list of coefficients.

evalPolynomial :: Polyn -> FField -> FField Source #

Evaluates the polynomial at a given point.