hMPC-0.1.0.2: Multiparty Computation in Haskell
Safe HaskellSafe-Inferred
LanguageHaskell2010

Runtime

Description

The hMPC runtime module is used to execute secure multiparty computations.

Parties perform computations on secret-shared values by exchanging messages. Shamir's threshold secret sharing scheme is used for finite fields of any order exceeding the number of parties. hMPC provides many secure data types, ranging from numeric types to more advanced types, for which the corresponding operations are made available through Haskell's mechanism for operator overloading.

Synopsis

Documentation

secIntGen :: Int -> SIO (Integer -> SIO SecureTypes) Source #

Secure l-bit integers (SecInt).

secFldGen :: Integer -> Integer -> SIO SecureTypes Source #

Secure finite field (SecFld) of order q = p where p is a prime number

runMpc :: SIO a -> IO a Source #

Runs MPC computation

runMpcWithArgs :: Parser b -> (b -> SIO a) -> IO a Source #

Runs MPC computation with user arguments

runSession :: SIO a -> SIO a Source #

Start and Stop hMPC runtime

class Input a b | a -> b Source #

Input x to the computation.

Value x is a secure object, or a list of secure objects.

Minimal complete definition

input

Instances

Instances details
Input (SIO SecureTypes) [SIO SecureTypes] Source # 
Instance details

Defined in Runtime

Input [SIO SecureTypes] [[SIO SecureTypes]] Source # 
Instance details

Defined in Runtime

input :: Input a b => a -> SIO b Source #

class Output a b | a -> b where Source #

Output the value of x to the receivers specified. Value x is a secure object, or a list of secure objects.

A secure integer is output as a Haskell Integer

Methods

output :: a -> SIO (MVar b) Source #

Instances

Instances details
Output (SIO SecureTypes) Integer Source # 
Instance details

Defined in Runtime

Output [SIO SecureTypes] [Integer] Source # 
Instance details

Defined in Runtime

transfer :: Serialize a => a -> SIO (MVar [a]) Source #

Transfer serializable Haskell objects

(.+) :: SIO SecureTypes -> SIO SecureTypes -> SIO SecureTypes Source #

Secure addition of a and b.

(.-) :: SIO SecureTypes -> SIO SecureTypes -> SIO SecureTypes Source #

Secure subtraction of a and b.

(.*) :: SIO SecureTypes -> SIO SecureTypes -> SIO SecureTypes Source #

Secure multiplication of a and b.

(./) :: SIO SecureTypes -> SIO SecureTypes -> SIO SecureTypes Source #

Secure division of a by b, for nonzero b.

srecip :: SIO SecureTypes -> SIO SecureTypes Source #

Secure reciprocal (multiplicative field inverse) of a, for nonzero a.

(.^) :: SIO SecureTypes -> Integer -> SIO SecureTypes Source #

Secure exponentiation a raised to the power of b, for public integer b.

(.<) :: SIO SecureTypes -> SIO SecureTypes -> SIO SecureTypes Source #

Secure comparison a < b.

(.<=) :: SIO SecureTypes -> SIO SecureTypes -> SIO SecureTypes Source #

Secure comparison a <= b.

(.>) :: SIO SecureTypes -> SIO SecureTypes -> SIO SecureTypes Source #

Secure comparison a > b.

(.==) :: SIO SecureTypes -> SIO SecureTypes -> SIO SecureTypes Source #

Secure comparison a == b.

isZero :: SIO SecureTypes -> SIO SecureTypes Source #

Secure zero test a == 0.

isZeroPublic :: SIO SecureTypes -> SIO (MVar Bool) Source #

Secure public zero test of a.

ssignum :: Bool -> Bool -> SIO SecureTypes -> SIO SecureTypes Source #

Secure sign(um) of a, return -1 if a < 0 else 0 if a == 0 else 1.

If Boolean flag LT is set, perform a secure less than zero test instead, and return 1 if a < 0 else 0, saving the work for a secure equality test. If Boolean flag EQ is set, perform a secure equal to zero test instead, and return 1 if a == 0 else 0, saving the work for a secure comparison.

argmax :: [SIO SecureTypes] -> SIO (SIO SecureTypes, SIO SecureTypes) Source #

Secure argmax of all given elements in x.

In case of multiple occurrences of the maximum values, the index of the first occurrence is returned.

smaximum :: [SIO SecureTypes] -> SIO SecureTypes Source #

Secure maximum of all given elements in x, similar to Haskell's built-in maximum.

ssum :: [SIO SecureTypes] -> SIO SecureTypes Source #

Secure sum of all elements in x, similar to Haskell's built-in sum.

sproduct :: [SIO SecureTypes] -> SIO SecureTypes Source #

Secure product of all elements in x, similar to Haskell's product.

Runs in log_2 len(x) rounds).

sall :: [SIO SecureTypes] -> SIO SecureTypes Source #

Secure all of elements in x, similar to Haskell's built-in all.

Elements of x are assumed to be either 0 or 1 (Boolean). Runs in log_2 len(x) rounds).

randomBits :: SIO SecureTypes -> Int -> Bool -> SIO [SIO SecureTypes] Source #

Return n secure uniformly random bits of the given type.

inProd :: [SIO SecureTypes] -> [SIO SecureTypes] -> SIO SecureTypes Source #

Secure dot product of x and y (one resharing).

schurProd :: [SIO SecureTypes] -> [SIO SecureTypes] -> SIO [SIO SecureTypes] Source #

Secure entrywise multiplication of vectors x and y.

matrixProd :: [[SIO SecureTypes]] -> [[SIO SecureTypes]] -> Bool -> SIO [[SIO SecureTypes]] Source #

Secure matrix product of A with (transposed) B.

class IfElse a b | a -> b where Source #

Secure selection between x and y based on condition c.

Methods

ifElse :: SIO SecureTypes -> a -> a -> SIO b Source #

Instances

Instances details
IfElse (SIO SecureTypes) SecureTypes Source # 
Instance details

Defined in Runtime

IfElse [SIO SecureTypes] [SIO SecureTypes] Source # 
Instance details

Defined in Runtime

async :: SIO a -> SIO (MVar a) Source #

forkIO the action monad asynchronously and return future MVar. Provide the given state monad with its own program counter space.

await :: MVar a -> SIO a Source #

Read the value from the future MVar (blocking).

Orphan instances