gitee.com/lh-her-team/common@v1.5.1/crypto/bulletproofs/bulletproofs_nocgo/proof.go (about) 1 package bulletproofs_nocgo 2 3 // ProveRandomOpening Generate proof with randomly pick opening 4 // x: prove x is in the range [0, 2^64) 5 // return 1: proof in []byte 6 // return 2: commitment of x: xB + rB' 7 // return 3: opening, the randomness r used to commit x (secret key) 8 func ProveRandomOpening(x uint64) ([]byte, []byte, []byte, error) { 9 return nil, nil, nil, ErrUnsupported 10 } 11 12 // ProveSpecificOpening Generate proof with a chosen opening 13 // x: prove x is in the range [0, 2^64) 14 // opening: the chosen randomness to commit x (secret key) 15 // return 1: proof in []byte 16 // return 2: commitment of x using opening 17 func ProveSpecificOpening(x uint64, opening []byte) ([]byte, []byte, error) { 18 return nil, nil, ErrUnsupported 19 } 20 21 // Verify Verify the validity of a proof 22 // proof: the zero-knowledge proof proving the number committed in commitment is in the range [0, 2^64) 23 // commitment: commitment bindingly hiding the number x 24 // return: true on valid proof, false otherwise 25 func Verify(proof []byte, commitment []byte) (bool, error) { 26 return false, ErrUnsupported 27 } 28 29 // ProveAfterAddNum Update a commitment of x (xB + rB') to x + y and generate a proof of it with the same opening 30 // x, y: prove x + y is in the range [0, 2^64) 31 // openingX: the randomness r used to commit x, also used in the new proof 32 // commitmentX: commitment of x: xB + rB' 33 // return 1: proof in []byte 34 // return 2: commitment of x + y: (x + y)B + rB' 35 func ProveAfterAddNum(x, y uint64, openingX, commitmentX []byte) ([]byte, []byte, error) { 36 return nil, nil, ErrUnsupported 37 } 38 39 // 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 40 // x, y: prove x + y is in the range [0, 2^64) 41 // openingX: the randomness r used to commit x 42 // openingY: the randomness s used to commit y 43 // commitmentX: commitment of x: xB + rB' 44 // commitmentX: commitment of y: yB + sB' 45 // return 1: proof in []byte 46 // return 2: commitment of x + y: (x + y)B + (r + s)B' 47 // return 3: new opening for the result commitment (r + s) 48 func ProveAfterAddCommitment(x, y uint64, openingX, openingY, commitmentX, commitmentY []byte) ([]byte, []byte, []byte, error) { 49 return nil, nil, nil, ErrUnsupported 50 } 51 52 // ProveAfterSubNum Update a commitment of x (xB + rB') to x - y and generate a proof of it with the same opening 53 // x, y: prove x - y is in the range [0, 2^64) 54 // openingX: the randomness r used to commit x, also used in the new proof 55 // commitmentX: commitment of x (old commitment) 56 // return 1: proof in []byte 57 // return 2: commitment of x - y: (x - y)B + rB' 58 func ProveAfterSubNum(x, y uint64, openingX, commitmentX []byte) ([]byte, []byte, error) { 59 return nil, nil, ErrUnsupported 60 } 61 62 // 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 63 // x, y: prove x + y is in the range [0, 2^64) 64 // openingX: the randomness r used to commit x 65 // openingY: the randomness s used to commit y 66 // commitmentX: commitment of x: xB + rB' 67 // commitmentX: commitment of y: yB + sB' 68 // return 1: proof in []byte 69 // return 2: commitment of x - y: (x - y)B + (r - s)B' 70 // return 3: new opening for the result commitment (r - s) 71 func ProveAfterSubCommitment(x, y uint64, openingX, openingY, commitmentX, commitmentY []byte) ([]byte, []byte, []byte, error) { 72 return nil, nil, nil, ErrUnsupported 73 } 74 75 // 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 76 // x, y: prove x * y is in the range [0, 2^64) 77 // openingX: the randomness r used to commit x 78 // commitmentX: commitment of x: xB + rB' 79 // return 1: proof in []byte 80 // return 2: commitment of x * y: (x * y)B + (r * y)B' 81 // return 3: new opening for the result commitment: r * y 82 func ProveAfterMulNum(x, y uint64, openingX, commitmentX []byte) ([]byte, []byte, []byte, error) { 83 return nil, nil, nil, ErrUnsupported 84 }