Struct smol_mpc::vm::VirtualMachine
source · pub struct VirtualMachine<'a, T: MersenneField> {
pub id: &'a str,
pub private_values: HashMap<&'a str, T>,
pub shares: HashMap<&'a str, Share<'a, T>>,
}
Expand description
Defines a virtual machine.
The virtual machine is represented as a node that has an ID based memory in which it saves the information. All the machines have an ID used to identify them during a protocol execution. The inspiration of this design comes from the way in wich an ideal functionality is specified in a Universal Composability proof, that is, as a entity that has a ID based memory to store elements and that also sends, process and receives information. However, we stress that this implementation is not the implementation of an ideal functionality, we just take the some elements.
The memory is divided into two types. The private memory will hold values that a certain node knows but are not secret-shared among the parties. The shares memory stores the shares of a certain value. To make things simple, when a value is public, it is stored in the private memory because, at the end, it is a value that is known all the machines. Each variable stored in the memory has also an ID to refer to it during the protocol execution. In particular, if a value is secret-shared among a certain set of parties, it will have the same ID in memory for all the virtual machines involved in the protocol.
Fields§
§id: &'a str
ID of the virtual machine.
private_values: HashMap<&'a str, T>
Memory for private values.
Memory for shared values.
Implementations§
source§impl<'a, 'b, T: MersenneField> VirtualMachine<'a, T>where
'a: 'b,
impl<'a, 'b, T: MersenneField> VirtualMachine<'a, T>where 'a: 'b,
sourcepub fn insert_priv_value(&mut self, id: &'a str, value: T)
pub fn insert_priv_value(&mut self, id: &'a str, value: T)
Inserts a value in the private memory using a provided ID.
Insert a share in the share memory using a provided ID.
sourcepub fn get_priv_value(&'a self, id: &'a str) -> &'b T
pub fn get_priv_value(&'a self, id: &'a str) -> &'b T
Returns a private value with the provided id stored in the private memory.
Returns the share with the provided ID previously stored in the share memory.