Documentation ¶
Index ¶
- func PedersenAddCommitment(commitment1, commitment2 []byte) ([]byte, error)
- func PedersenAddCommitmentWithOpening(commitment1, commitment2, opening1, opening2 []byte) ([]byte, []byte, error)
- func PedersenAddNum(commitment []byte, value uint64) ([]byte, error)
- func PedersenAddOpening(opening1, opening2 []byte) ([]byte, error)
- func PedersenCommitRandomOpening(x uint64) ([]byte, []byte, error)
- func PedersenCommitSpecificOpening(x uint64, r []byte) ([]byte, error)
- func PedersenMulNum(commitment1 []byte, value uint64) ([]byte, error)
- func PedersenMulNumWithOpening(commitment []byte, opening []byte, value uint64) ([]byte, []byte, error)
- func PedersenMulOpening(opening1 []byte, value uint64) ([]byte, error)
- func PedersenNeg(commitment []byte) ([]byte, error)
- func PedersenNegOpening(opening []byte) ([]byte, error)
- func PedersenRNG() ([]byte, error)
- func PedersenSubCommitment(commitment1, commitment2 []byte) ([]byte, error)
- func PedersenSubCommitmentWithOpening(commitment1, commitment2, opening1, opening2 []byte) ([]byte, []byte, error)
- func PedersenSubNum(commitment []byte, value uint64) ([]byte, error)
- func PedersenSubOpening(opening1, opening2 []byte) ([]byte, error)
- func PedersenVerify(commitment, opening []byte, value uint64) (bool, error)
- func ProveAfterAddCommitment(x, y uint64, openingX, openingY, commitmentX, commitmentY []byte) ([]byte, []byte, []byte, error)
- func ProveAfterAddNum(x, y uint64, openingX, commitmentX []byte) ([]byte, []byte, error)
- func ProveAfterMulNum(x, y uint64, openingX, commitmentX []byte) ([]byte, []byte, []byte, error)
- func ProveAfterSubCommitment(x, y uint64, openingX, openingY, commitmentX, commitmentY []byte) ([]byte, []byte, []byte, error)
- func ProveAfterSubNum(x, y uint64, openingX, commitmentX []byte) ([]byte, []byte, error)
- func ProveRandomOpening(x uint64) ([]byte, []byte, []byte, error)
- func ProveSpecificOpening(x uint64, opening []byte) ([]byte, []byte, error)
- func Verify(proof []byte, commitment []byte) (bool, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func PedersenAddCommitment ¶
PedersenAddCommitment Compute a commitment to x + y from commitments to x and y, without revealing the value x and y commitment1: commitment to x: Cx = xB + rB' commitment2: commitment to y: Cy = yB + sB' return: commitment to x + y: C = (x + y)B + (r + s)B'
func PedersenAddCommitmentWithOpening ¶
func PedersenAddCommitmentWithOpening(commitment1, commitment2, opening1, opening2 []byte) ([]byte, []byte, error)
PedersenAddCommitmentWithOpening Compute a commitment to x + y without revealing the value x and y commitment1: commitment to x: Cx = xB + rB' commitment2: commitment to y: Cy = yB + sB' return1: the new commitment to x + y: C' = (x + y)B + rB' return2: the new opening r + s
func PedersenAddNum ¶
PedersenAddNum Compute a commitment to x + y from a commitment to x without revealing the value x, where y is a scalar commitment: C = xB + rB' value: the value y return1: the new commitment to x + y: C' = (x + y)B + rB'
func PedersenAddOpening ¶
PedersenAddOpening Compute the sum of two openings. Openings are big numbers with 256 bits. opening1, opening2: the two openings r and s to be summed return: the result opening: r + s
func PedersenCommitRandomOpening ¶
PedersenCommitRandomOpening compute Pedersen commitment on a value x with a randomly chosen opening x: the value to commit return1: commitment C = xB + rB' return2: opening r (randomly picked)
func PedersenCommitSpecificOpening ¶
PedersenCommitSpecificOpening compute Pedersen commitment on a value x with a given opening x: the value to commit return1: commitment C = xB + rB'
func PedersenMulNum ¶
PedersenMulNum Compute a commitment to x * y from a commitment to x and an integer y, without revealing the value x and y commitment1: commitment to x: Cx = xB + rB' value: integer value y return: commitment to x * y: C = (x * y)B + (r * y)B'
func PedersenMulNumWithOpening ¶
func PedersenMulNumWithOpening(commitment []byte, opening []byte, value uint64) ([]byte, []byte, error)
PedersenMulNumWithOpening Compute a commitment to x * y from a commitment to x and an integer y, without revealing the value x and y commitment: commitment to x: Cx = xB + rB' opening: opening to Cx: r value: integer value y return1: commitment to x * y: C = (x * y)B + (r * y)B' return2: opening to the result commitment: r * y
func PedersenMulOpening ¶
PedersenMulOpening Compute opening1 * integer. Openings are big numbers with 256 bits. opening1: the input opening r value: the input integer value y return: the multiplication r * y as a big number with 256 bits in []byte form
func PedersenNeg ¶
PedersenNeg Compute a commitment to -x from a commitment to x without revealing the value x commitment: C = xB + rB' value: the value y return1: the new commitment to x + y: C' = (x + y)B + rB'
func PedersenNegOpening ¶
PedersenNegOpening Compute the negation of opening. Openings are big numbers with 256 bits. opening: the opening r to be negated return: the result opening: -r
func PedersenRNG ¶
PedersenRNG generate a truly random scalar (which can be used as an opening to generate a commitment). return: a random scalar in []byte format
func PedersenSubCommitment ¶
PedersenSubCommitment Compute a commitment to x - y from commitments to x and y, without revealing the value x and y commitment1: commitment to x: Cx = xB + rB' commitment2: commitment to y: Cy = yB + sB' return: commitment to x - y: C = (x - y)B + (r - s)B'
func PedersenSubCommitmentWithOpening ¶
func PedersenSubCommitmentWithOpening(commitment1, commitment2, opening1, opening2 []byte) ([]byte, []byte, error)
PedersenSubCommitmentWithOpening Compute a commitment to x - y without from two commitments of x and y respectively commitment1: commitment to x: Cx = xB + rB' commitment2: commitment to y: Cy = yB + sB' return1: the new commitment to x - y: C' = (x - y)B + (r - s)B' return2: the new opening r - s
func PedersenSubNum ¶
PedersenSubNum Compute a commitment to x - y from a commitment to x without revealing the value x, where y is a scalar commitment: C = xB + rB' value: the value y return1: the new commitment to x - y: C' = (x - y)B + rB'
func PedersenSubOpening ¶
PedersenSubOpening Compute opening1 - opening2. Openings are big numbers with 256 bits. opening1, opening2: two openings r and s return: the result opening r - s
func PedersenVerify ¶
PedersenVerify verify the validity of a commitment with respect to a value-opening pair commitment: the commitment to be opened or verified: xB + rB' opening: the opening of the commitment: r value: the value claimed being binding to commitment: x return1: true if commitment is valid, false otherwise
func ProveAfterAddCommitment ¶
func ProveAfterAddCommitment(x, y uint64, openingX, openingY, commitmentX, commitmentY []byte) ([]byte, []byte, []byte, error)
ProveAfterAddCommitment Update commitments of x (xB + rB') and y (yB + sB') to x + y and generate a proof of it with the sum of the two opening x, y: prove x + y is in the range [0, 2^64) openingX: the randomness r used to commit x openingY: the randomness s used to commit y commitmentX: commitment of x: xB + rB' commitmentX: commitment of y: yB + sB' return 1: proof in []byte return 2: commitment of x + y: (x + y)B + (r + s)B' return 3: new opening for the result commitment (r + s)
func ProveAfterAddNum ¶
ProveAfterAddNum Update a commitment of x (xB + rB') to x + y and generate a proof of it with the same opening x, y: prove x + y is in the range [0, 2^64) openingX: the randomness r used to commit x, also used in the new proof commitmentX: commitment of x: xB + rB' return 1: proof in []byte return 2: commitment of x + y: (x + y)B + rB'
func ProveAfterMulNum ¶
ProveAfterMulNum Update commitment of x (xB + rB') to commitment of x * y and generate a proof of it with the an updated opening, where y is a value x, y: prove x * y is in the range [0, 2^64) openingX: the randomness r used to commit x commitmentX: commitment of x: xB + rB' return 1: proof in []byte return 2: commitment of x * y: (x * y)B + (r * y)B' return 3: new opening for the result commitment: r * y
func ProveAfterSubCommitment ¶
func ProveAfterSubCommitment(x, y uint64, openingX, openingY, commitmentX, commitmentY []byte) ([]byte, []byte, []byte, error)
ProveAfterSubCommitment Update commitments of x (xB + rB') and y (yB + sB') to x - y and generate a proof of it with the subtraction of the two openings x, y: prove x + y is in the range [0, 2^64) openingX: the randomness r used to commit x openingY: the randomness s used to commit y commitmentX: commitment of x: xB + rB' commitmentX: commitment of y: yB + sB' return 1: proof in []byte return 2: commitment of x - y: (x - y)B + (r - s)B' return 3: new opening for the result commitment (r - s)
func ProveAfterSubNum ¶
ProveAfterSubNum Update a commitment of x (xB + rB') to x - y and generate a proof of it with the same opening x, y: prove x - y is in the range [0, 2^64) openingX: the randomness r used to commit x, also used in the new proof commitmentX: commitment of x (old commitment) return 1: proof in []byte return 2: commitment of x - y: (x - y)B + rB'
func ProveRandomOpening ¶
ProveRandomOpening Generate proof with randomly pick opening x: prove x is in the range [0, 2^64) return 1: proof in []byte return 2: commitment of x: xB + rB' return 3: opening, the randomness r used to commit x (secret key)
func ProveSpecificOpening ¶
ProveSpecificOpening Generate proof with a chosen opening x: prove x is in the range [0, 2^64) opening: the chosen randomness to commit x (secret key) return 1: proof in []byte return 2: commitment of x using opening
Types ¶
This section is empty.