[−][src]Struct hbbft::threshold_decrypt::ThresholdDecrypt
A Threshold Decrypt algorithm instance. If every node inputs the same data, encrypted to the network's public key, every node will output the decrypted data.
Methods
impl<N: NodeIdT> ThresholdDecrypt<N>
[src]
pub fn new(netinfo: Arc<NetworkInfo<N>>) -> Self
[src]
Creates a new Threshold Decrypt instance.
pub fn new_with_ciphertext(
netinfo: Arc<NetworkInfo<N>>,
ct: Ciphertext
) -> Result<Self>
[src]
netinfo: Arc<NetworkInfo<N>>,
ct: Ciphertext
) -> Result<Self>
Creates a new instance of ThresholdDecrypt
, including setting the ciphertext to
decrypt.
pub fn set_ciphertext(&mut self, ct: Ciphertext) -> Result<()>
[src]
Sets the ciphertext, sends the decryption share, and tries to decrypt it. This must be called exactly once, with the same ciphertext in all participating nodes. If we have enough shares, outputs the plaintext.
pub fn start_decryption(&mut self) -> Result<Step<N>>
[src]
Sends our decryption shares to peers, and if we have collected enough, returns the decrypted message. Returns an error if the ciphertext hasn't been received yet.
pub fn sender_ids(&self) -> impl Iterator<Item = &N>
[src]
Returns an iterator over the IDs of all nodes who sent a share.
pub fn handle_message(
&mut self,
sender_id: &N,
message: Message
) -> Result<Step<N>>
[src]
&mut self,
sender_id: &N,
message: Message
) -> Result<Step<N>>
Handles a message with a decryption share received from sender_id
.
This must be called with every message we receive from another node.
If we have collected enough, returns the decrypted message.
Trait Implementations
impl<N: NodeIdT> ConsensusProtocol for ThresholdDecrypt<N>
[src]
type NodeId = N
Unique node identifier.
type Input = ()
The input provided by the user.
type Output = Vec<u8>
The output type. Some algorithms return an output exactly once, others return multiple times. Read more
type Message = Message
The messages that need to be exchanged between the instances in the participating nodes.
type Error = Error
The errors that can occur during execution.
type FaultKind = FaultKind
The kinds of message faults that can be detected during execution.
fn handle_input<R: Rng>(&mut self, _input: (), _rng: &mut R) -> Result<Step<N>>
[src]
fn handle_message<R: Rng>(
&mut self,
sender_id: &Self::NodeId,
message: Message,
_rng: &mut R
) -> Result<Step<N>>
[src]
&mut self,
sender_id: &Self::NodeId,
message: Message,
_rng: &mut R
) -> Result<Step<N>>
fn terminated(&self) -> bool
[src]
fn our_id(&self) -> &N
[src]
impl<N: Debug> Debug for ThresholdDecrypt<N>
[src]
Auto Trait Implementations
impl<N> Send for ThresholdDecrypt<N> where
N: Send + Sync,
N: Send + Sync,
impl<N> Sync for ThresholdDecrypt<N> where
N: Send + Sync,
N: Send + Sync,
Blanket Implementations
impl<T, U> Into for T where
U: From<T>,
[src]
U: From<T>,
impl<T> From for T
[src]
impl<T, U> TryFrom for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T> Borrow for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> BorrowMut for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T, U> TryInto for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,