pub fn node_gen(node: &BTENode, child: Bit, rng: &mut impl RAND, sys: &SysParam) -> BTENode {
    let spec_r = BIG::new_ints(&rom::CURVE_ORDER);
    let delta = BIG::randomnum(&spec_r, rng);
    let g1 = ECP::generator();

    // Construct new tau.
    let mut new_tau = node.tau.clone();
    new_tau.push(child);

    // Compute new a: new_a = a * g_1 ^ delta
    let mut new_a = g1.mul(&delta);
    new_a.add(&node.a);

    // Compute new b and new d_t.
    let mut new_b = node.b.clone();
    let mut new_d_t = LinkedList::new();
    let f_tau = match ftau_partial(&new_tau, sys) {
        None => {
            unreachable!("node_gen() on leaf node");
        }
        Some(x) => x,
    };
    let offset = node.tau.len();
    let mut iter = node.d_t.iter().enumerate();
    // The first entry of `d_t` is used for `new_b`
    if let Some((_, d)) = iter.next() {
        new_b.add(&f_tau.mul(&delta));
        if child == Bit::One {
            new_b.add(d);
        }
    };
    // The remanining entries of `d_t` are used for `new_d_t`
    for (i, d) in iter {
        let mut new_d = sys.f[offset + i].mul(&delta);
        new_d.add(d);
        new_d_t.push_back(new_d);
    }

    // Compute new d_h.
    let mut new_d_h = Vec::with_capacity(node.d_h.len());
    for (i, d) in node.d_h.iter().enumerate() {
        let mut new_d = sys.f_h[i].mul(&delta);
        new_d.add(d);
        new_d_h.push(new_d);
    }

    // Compute new e.
    let mut new_e = sys.h.mul(&delta);
    new_e.add(&node.e);

    BTENode {
        tau: new_tau,
        a: new_a,
        b: new_b,
        d_t: new_d_t,
        d_h: new_d_h,
        e: new_e,
    }
}
/// Generates the specified child of a given BTE node.
/// Only used by slow_derive(), which has been superseded by fast_derive().
/// We keep it around as documentation. Hopefully it makes fast_derive() easier
/// to understand.
Generates the specified child of a given BTE node.
Only used by slow_derive(), which has been superseded by fast_derive().
We keep it around as documentation. Hopefully it makes fast_derive() easier
to understand.
Generates the specified child of a given BTE node . Only used by slow_derive () which has been superseded by fast_derive () . We keep it around as documentation . Hopefully it makes fast_derive () easier to understand .
pub fn node_gen(node: &BTENode, child: Bit, rng: &mut impl RAND, sys: &SysParam) -> BTENode {
    let spec_r = BIG::new_ints(&rom::CURVE_ORDER);
    let delta = BIG::randomnum(&spec_r, rng);
    let g1 = ECP::generator();
    // Construct new tau.
    let mut new_tau = node.tau.clone();
    new_tau.push(child);
    // Compute new a: new_a = a * g_1 ^ delta
    let mut new_a = g1.mul(&delta);
    new_a.add(&node.a);
    // Compute new b and new d_t.
    let mut new_b = node.b.clone();
    let mut new_d_t = LinkedList::new();
    let f_tau = match ftau_partial(&new_tau, sys) {
        None => {
            unreachable!("node_gen() on leaf node");
        }
        Some(x) => x,
    };
    let offset = node.tau.len();
    let mut iter = node.d_t.iter().enumerate();
    // The first entry of `d_t` is used for `new_b`
    if let Some((_, d)) = iter.next() {
        new_b.add(&f_tau.mul(&delta));
        if child == Bit::One {
            new_b.add(d);
        }
    };
    // The remanining entries of `d_t` are used for `new_d_t`
    for (i, d) in iter {
        let mut new_d = sys.f[offset + i].mul(&delta);
        new_d.add(d);
        new_d_t.push_back(new_d);
    }
    // Compute new d_h.
    let mut new_d_h = Vec::with_capacity(node.d_h.len());
    for (i, d) in node.d_h.iter().enumerate() {
        let mut new_d = sys.f_h[i].mul(&delta);
        new_d.add(d);
        new_d_h.push(new_d);
    }
    // Compute new e.
    let mut new_e = sys.h.mul(&delta);
    new_e.add(&node.e);
    BTENode {
        tau: new_tau,
        a: new_a,
        b: new_b,
        d_t: new_d_t,
        d_h: new_d_h,
        e: new_e,
    }
}
pub fn node_gen ( node : & BTENode , child : Bit , rng : & mut impl RAND , sys : & SysParam ) -> BTENode { let spec_r = BIG :: new_ints ( & rom :: CURVE_ORDER ) ; let delta = BIG :: randomnum ( & spec_r , rng ) ; let g1 = ECP :: generator ( ) ; // Construct new tau. let mut new_tau = node . tau . clone ( ) ; new_tau . push ( child ) ; // Compute new a: new_a = a * g_1 ^ delta let mut new_a = g1 . mul ( & delta ) ; new_a . add ( & node . a ) ; // Compute new b and new d_t. let mut new_b = node . b . clone ( ) ; let mut new_d_t = LinkedList :: new ( ) ; let f_tau = match ftau_partial ( & new_tau , sys ) { None => { unreachable ! ( " " ) ; } Some ( x ) => x , } ; let offset = node . tau . len ( ) ; let mut iter = node . d_t . iter ( ) . enumerate ( ) ; // The first entry of `d_t` is used for `new_b` if let Some ( ( _ , d ) ) = iter . next ( ) { new_b . add ( & f_tau . mul ( & delta ) ) ; if child == Bit :: One { new_b . add ( d ) ; } } ; // The remanining entries of `d_t` are used for `new_d_t` for ( i , d ) in iter { let mut new_d = sys . f [ offset + i ] . mul ( & delta ) ; new_d . add ( d ) ; new_d_t . push_back ( new_d ) ; } // Compute new d_h. let mut new_d_h = Vec :: with_capacity ( node . d_h . len ( ) ) ; for ( i , d ) in node . d_h . iter ( ) . enumerate ( ) { let mut new_d = sys . f_h [ i ] . mul ( & delta ) ; new_d . add ( d ) ; new_d_h . push ( new_d ) ; } // Compute new e. let mut new_e = sys . h . mul ( & delta ) ; new_e . add ( & node . e ) ; BTENode { tau : new_tau , a : new_a , b : new_b , d_t : new_d_t , d_h : new_d_h , e : new_e , } }
Generates the specified child of a given BTE node.
Generates the specified child of a given BTE node .
node
&BTENode
child
Bit
rng
&mut impl RAND
sys
&SysParam
node
&BTENode
child
Bit
rng
&mut impl RAND
sys
&SysParam