[][src]Module bulletproofs::util

Structs

Poly2

Represents a degree-2 scalar polynomial \(a + b \cdot x + c \cdot x^2\)

Poly6

Represents a degree-6 scalar polynomial, without the zeroth degree \(a \cdot x + b \cdot x^2 + c \cdot x^3 + d \cdot x^4 + e \cdot x^5 + f \cdot x^6\)

ScalarExp

Provides an iterator over the powers of a Scalar.

VecPoly1

Represents a degree-1 vector polynomial \(\mathbf{a} + \mathbf{b} \cdot x\).

VecPoly3

Represents a degree-3 vector polynomial \(\mathbf{a} + \mathbf{b} \cdot x + \mathbf{c} \cdot x^2 + \mathbf{d} \cdot x^3 \).

Functions

add_vec
exp_iter

Return an iterator of the powers of x.

read32

Given data with len >= 32, return the first 32 bytes.

scalar_exp_vartime

Raises x to the power n using binary exponentiation, with (1 to 2)*lg(n) scalar multiplications. TODO: a consttime version of this would be awfully similar to a Montgomery ladder.

sum_of_powers

Takes the sum of all the powers of x, up to n If n is a power of 2, it uses the efficient algorithm with 2*lg n multiplications and additions. If n is not a power of 2, it uses the slow algorithm with n multiplications and additions. In the Bulletproofs case, all calls to sum_of_powers should have n as a power of 2.

sum_of_powers_slow