Struct chain_vote::TallyOptimizationTable
source · pub struct TallyOptimizationTable {
table: HashMap<Option<[u8; 32]>, u64>,
baby_step_size: u64,
giant_step: GroupElement,
}
Expand description
Holds precomputed baby steps for the baby-stap giant-step algorithm for solving discrete log on ECC
Fields§
§table: HashMap<Option<[u8; 32]>, u64>
§baby_step_size: u64
§giant_step: GroupElement
Implementations§
source§impl BabyStepsTable
impl BabyStepsTable
sourcepub fn generate(max_value: NonZeroU64) -> Self
pub fn generate(max_value: NonZeroU64) -> Self
Generate the table with asymmetrical steps, optimized for multiple reuse of the same table.
sourcepub fn generate_with_balance(max_value: NonZeroU64, balance: NonZeroU64) -> Self
pub fn generate_with_balance(max_value: NonZeroU64, balance: NonZeroU64) -> Self
Generate the table with the given balance. Balance is used to make steps asymmetrical. If the table is reused multiple times with the same max_value it is recommended to set a balance > 1, since this will allow to cache more results, at the expense of a higher memory footprint.
For example, a balance of 2 means that the table will precompute 2 times more baby steps than the standard O(sqrt(n)), 1 means symmetrical steps.
Trait Implementations§
source§impl Clone for BabyStepsTable
impl Clone for BabyStepsTable
source§fn clone(&self) -> BabyStepsTable
fn clone(&self) -> BabyStepsTable
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreAuto Trait Implementations§
impl RefUnwindSafe for BabyStepsTable
impl Send for BabyStepsTable
impl Sync for BabyStepsTable
impl Unpin for BabyStepsTable
impl UnwindSafe for BabyStepsTable
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more