protocols

Namespace

protocols

Description:
  • Contains miscellaneous protocols (mostly used in preprocessing)

Source:

Members

(static, non-null) bits :bits

Description:
  • A collection of useful protocols for manipulating bitwise shared numbers, and transforming them from and to regular numeric shares.

Source:

A collection of useful protocols for manipulating bitwise shared numbers, and transforming them from and to regular numeric shares.

Type:

Methods

(static) jiffClient.protocols.generate_beaver_bgw(threshold, receivers_list, compute_list, Zp, params, protocols) → {object}

Description:
  • Generation of beaver triplet via MPC, uses the server for communication channels, but not for generation

Source:
Parameters:
Name Type Description
threshold number

the threshold of the triplets when stored by receivers after generation

receivers_list Array

array of party ids that want to receive the triplet shares

compute_list Array

array of party ids that will perform this protocol

Zp number

the mod

params object

an object containing extra parameters passed by the user Expects: - op_id: the base id to use for operation during the execution of this protocol, defaults to auto generated - an optional number compute_threshold parameter, which specifies threshold used during the protocol execution. By default, this is the length of the (compute_list+1)/2

protocols object

the sub protocols to use for preprocessing

Returns:

all pre-processing protocols must return an object with these keys: { 'share': the share(s)/value(s) to store attached to op_id for later use by the computation (i.e. the result of preprocessing), 'promise': a promise for when this protocol is fully completed (could be null if the protocol was already completed) } In this case, 'share' is an array of this party's shares of the resulting triplet, a,b,c such that a*b=c

Type
object

(static) jiffClient.protocols.generate_random_and_quotient(threshold, receivers_list, compute_list, Zp, params) → {Object}

Description:
  • Creates shares of r and x, such that r is a uniform random number between 0 and Zp, and x is floor(r/constant) where constant is provided by the extra params

Source:
Parameters:
Name Type Description
threshold number

the min number of parties needed to reconstruct the secret after it is computed

receivers_list Array

array of party ids to receive the result

compute_list Array

array of party ids to perform the protocol

Zp number

the mod

params object

an object containing extra parameters passed by the user Expects: - op_id: the base id to use for operation during the execution of this protocol, defaults to auto generated - compute_threshold: the threshold to use during computation: defaults to compute_list.length - constant: the constant to divide the random number by. - output_op_id: the set op id of the output quotient and noise

Returns:

contains 'share' (this party's share of the result) and 'promise'

Type
Object

(static) jiffClient.protocols.generate_random_bit_bgw(threshold, receivers_list, compute_list, Zp, params) → {Object}

Description:
  • Generates a random bit under MPC by xoring all bits sent by participating parties using smult_bgw

Source:
Parameters:
Name Type Description
threshold number

the min number of parties needed to reconstruct the secret after it is computed.

receivers_list Array

array of party ids to receive the result.

compute_list Array

array of party ids to perform the protocol.

Zp number

the mod.

params object

an object containing extra parameters passed by the user. Expects: - op_id: the base id to use for operation during the execution of this protocol, defaults to auto generated. - compute_threshold: the threshold to use during computation: defaults to compute_list.length

Returns:

contains 'share' (this party's share of the generated bit) and 'promise'.

Type
Object

(static) jiffClient.protocols.generate_random_bit_smult(threshold, receivers_list, compute_list, Zp, params) → {Object}

Description:
  • Generates a random bit under MPC by xoring all bits sent by participating parties using smult / beaver triples

Source:
Parameters:
Name Type Description
threshold number

the min number of parties needed to reconstruct the secret after it is computed.

receivers_list Array

array of party ids to receive the result.

compute_list Array

array of party ids to perform the protocol.

Zp number

the mod.

params object

an object containing extra parameters passed by the user. Expects: - op_id: the base id to use for operation during the execution of this protocol, defaults to auto generated. - compute_threshold: the threshold to use during computation: defaults to compute_list.length

Returns:

contains 'share' (this party's share of the generated bit) and 'promise'.

Type
Object

(static) jiffClient.protocols.generate_random_bits(thresholdopt, receivers_list, compute_list, Zp, params, protocols) → {Object}

Description:
  • Generates a sequence of random bits under MPC.

Source:
Parameters:
Name Type Attributes Default Description
threshold number <optional>
receivers_list.length

the threshold of the bit when stored by receivers after generation. * @param {number} threshold - the min number of parties needed to reconstruct the secret after it is computed.

receivers_list Array

array of party ids to receive the result.

compute_list Array

array of party ids to perform the protocol.

Zp number

the mod.

params object

an object containing extra parameters passed by the user. Expects: - op_id: the base id to use for operation during the execution of this protocol, defaults to auto generated. - count: how many random bits to generate. - compute_threshold: the threshold to use during computation: defaults to compute_list.length

protocols object

the protocols to use for preprocessing.

Returns:

contains 'share' (array of secret shares bits) and 'promise'.

Type
Object

(static) jiffClient.protocols.generate_random_number(threshold, receivers_list, compute_list, Zp, params) → {Object}

Description:
  • Creates shares of an unknown random number. Every party comes up with its own random number and shares it. Then every party combines all the received shares to construct one share of the random unknown number.

Source:
Parameters:
Name Type Description
threshold number

the min number of parties needed to reconstruct the secret after it is computed.

receivers_list Array

array of party ids to receive the result.

compute_list Array

array of party ids to perform the protocol.

Zp number

the mod.

params object

an object containing extra parameters passed by the user. Expects: - op_id: the base id to use for operation during the execution of this protocol, defaults to auto generated. - compute_threshold: the threshold to use during computation: defaults to compute_list.length

Returns:

contains 'share' (this party's share of the result) and 'promise'.

Type
Object

(static) jiffClient.protocols.generate_zero(threshold, receivers_list, compute_list, Zp, params) → {Object}

Description:
  • Creates shares of 0, such that no party knows the other parties' shares. Every party secret shares 0, then every party sums all the shares they received, resulting in a new share of 0 for every party.

Source:
Parameters:
Name Type Description
threshold number

the min number of parties needed to reconstruct the secret after it is computed.

receivers_list Array

array of party ids to receive the result.

compute_list Array

array of party ids to perform the protocol.

Zp number

the mod.

params object

an object containing extra parameters passed by the user. Expects: - op_id: the base id to use for operation during the execution of this protocol, defaults to auto generated. - compute_threshold: the threshold to use during computation: defaults to compute_list.length

Returns:

contains 'share' (this party's share of the result) and 'promise'.

Type
Object

(static) jiffClient.protocols.rejection_sampling(thresholdopt, receivers_listopt, compute_listopt, Zpopt, op_idopt, paramsopt, protocolsopt) → {Object}

Description:
  • Wrapper for when doing rejection sampling during pre processing

    Do not use this function directly, especially during online computation time, use jiffClient.protocols.bits.rejection_sampling instead

Source:
Parameters:
Name Type Attributes Default Description
threshold number <optional>
receivers_list.length

the threshold of the resulting shares after sampling

receivers_list Array <optional>
all_parties

array of party ids that want to receive the sampling shares, by default, this includes all parties

compute_list Array <optional>
all_parties

array of party ids that will perform this protocol, by default, this includes all parties

Zp number <optional>
jiff-instance.Zp

the mod (if null then the default Zp for the instance is used)

op_id string <optional>
auto_gen()

the operation id which is used to identify this operation. This id must be unique, and must be passed by all parties to the same instruction, to ensure that corresponding instructions across different parties are matched correctly

params object <optional>
{}

an object containing extra parameters passed by the user Expects: - an optional number compute_threshold parameter, which specifies threshold used during the protocol execution. By default, this is (|compute_list|+1)/2 - optional 'lower_bound' and 'upper_bound' numeric parameters, default to 0 and Zp respectively - op_id, the base op_id to tag operations inside this protocol with, defaults to auto generated - output_op_id, the tag id for the output result - retry_count, how many times rejection sampling have been retried!

protocols object <optional>
defaults

the protocols to use for preprocessing, any protocol(s) not provided will be replaced with defaults

Returns:

an object containing keys: 'share', and 'promise'. The promise is resolved when the rejection sampling is completed. The object is consumed by <jiff_instance>.preprocessing: - 'share' attribute contains the resulting array of secret shared bits representing the sampled value, and is stored in the preprocessing table internally - The promise is consumed and a new promise is returned by <jiff_instance>.preprocessing that is resolved after this returned promise (and all other promise generated by that .preprocessing call) are resolved

Type
Object