gitee.com/lh-her-team/common@v1.5.1/crypto/bulletproofs/bulletproofs_nocgo/commitment.go (about)

     1  package bulletproofs_nocgo
     2  
     3  import "C"
     4  
     5  // PedersenRNG generate a truly random scalar (which can be used as an opening to generate a commitment).
     6  // return: a random scalar in []byte format
     7  func PedersenRNG() ([]byte, error) {
     8  	return nil, ErrUnsupported
     9  }
    10  
    11  // PedersenCommitRandomOpening compute Pedersen commitment on a value x with a randomly chosen opening
    12  // x: the value to commit
    13  // return1: commitment C = xB + rB'
    14  // return2: opening r (randomly picked)
    15  func PedersenCommitRandomOpening(x uint64) ([]byte, []byte, error) {
    16  	return nil, nil, ErrUnsupported
    17  }
    18  
    19  // PedersenCommitSpecificOpening compute Pedersen commitment on a value x with a given opening
    20  // x: the value to commit
    21  // return1: commitment C = xB + rB'
    22  func PedersenCommitSpecificOpening(x uint64, r []byte) ([]byte, error) {
    23  	return nil, ErrUnsupported
    24  }
    25  
    26  // PedersenVerify verify the validity of a commitment with respect to a value-opening pair
    27  // commitment: the commitment to be opened or verified: xB + rB'
    28  // opening: the opening of the commitment: r
    29  // value: the value claimed being binding to commitment: x
    30  // return1: true if commitment is valid, false otherwise
    31  func PedersenVerify(commitment, opening []byte, value uint64) (bool, error) {
    32  	return false, ErrUnsupported
    33  }
    34  
    35  // PedersenNeg Compute a commitment to -x from a commitment to x without revealing the value x
    36  // commitment: C = xB + rB'
    37  // value: the value y
    38  // return1: the new commitment to x + y: C' = (x + y)B + rB'
    39  func PedersenNeg(commitment []byte) ([]byte, error) {
    40  	return nil, ErrUnsupported
    41  }
    42  
    43  // PedersenNegOpening Compute the negation of opening. Openings are big numbers with 256 bits.
    44  // opening: the opening r to be negated
    45  // return: the result opening: -r
    46  func PedersenNegOpening(opening []byte) ([]byte, error) {
    47  	return nil, ErrUnsupported
    48  }
    49  
    50  // PedersenAddNum Compute a commitment to x + y from a commitment to x without revealing the value x, where y is a scalar
    51  // commitment: C = xB + rB'
    52  // value: the value y
    53  // return1: the new commitment to x + y: C' = (x + y)B + rB'
    54  func PedersenAddNum(commitment []byte, value uint64) ([]byte, error) {
    55  	return nil, ErrUnsupported
    56  }
    57  
    58  // PedersenAddCommitment Compute a commitment to x + y from commitments to x and y, without revealing the value x and y
    59  // commitment1: commitment to x: Cx = xB + rB'
    60  // commitment2: commitment to y: Cy = yB + sB'
    61  // return: commitment to x + y: C = (x + y)B + (r + s)B'
    62  func PedersenAddCommitment(commitment1, commitment2 []byte) ([]byte, error) {
    63  	return nil, ErrUnsupported
    64  }
    65  
    66  // PedersenAddOpening Compute the sum of two openings. Openings are big numbers with 256 bits.
    67  // opening1, opening2: the two openings r and s to be summed
    68  // return: the result opening: r + s
    69  func PedersenAddOpening(opening1, opening2 []byte) ([]byte, error) {
    70  	return nil, ErrUnsupported
    71  }
    72  
    73  // PedersenAddCommitmentWithOpening Compute a commitment to x + y without revealing the value x and y
    74  // commitment1: commitment to x: Cx = xB + rB'
    75  // commitment2: commitment to y: Cy = yB + sB'
    76  // return1: the new commitment to x + y: C' = (x + y)B + rB'
    77  // return2: the new opening r + s
    78  func PedersenAddCommitmentWithOpening(commitment1, commitment2, opening1, opening2 []byte) ([]byte, []byte, error) {
    79  	return nil, nil, ErrUnsupported
    80  }
    81  
    82  // PedersenSubNum Compute a commitment to x - y from a commitment to x without revealing the value x, where y is a scalar
    83  // commitment: C = xB + rB'
    84  // value: the value y
    85  // return1: the new commitment to x - y: C' = (x - y)B + rB'
    86  func PedersenSubNum(commitment []byte, value uint64) ([]byte, error) {
    87  	return nil, ErrUnsupported
    88  }
    89  
    90  // PedersenSubCommitment Compute a commitment to x - y from commitments to x and y, without revealing the value x and y
    91  // commitment1: commitment to x: Cx = xB + rB'
    92  // commitment2: commitment to y: Cy = yB + sB'
    93  // return: commitment to x - y: C = (x - y)B + (r - s)B'
    94  func PedersenSubCommitment(commitment1, commitment2 []byte) ([]byte, error) {
    95  	return nil, ErrUnsupported
    96  }
    97  
    98  // PedersenSubOpening Compute opening1 - opening2. Openings are big numbers with 256 bits.
    99  // opening1, opening2: two openings r and s
   100  // return: the result opening r - s
   101  func PedersenSubOpening(opening1, opening2 []byte) ([]byte, error) {
   102  	return nil, ErrUnsupported
   103  }
   104  
   105  // PedersenSubCommitmentWithOpening Compute a commitment to x - y without from two commitments of x and y respectively
   106  // commitment1: commitment to x: Cx = xB + rB'
   107  // commitment2: commitment to y: Cy = yB + sB'
   108  // return1: the new commitment to x - y: C' = (x - y)B + (r - s)B'
   109  // return2: the new opening r - s
   110  func PedersenSubCommitmentWithOpening(commitment1, commitment2, opening1, opening2 []byte) ([]byte, []byte, error) {
   111  	return nil, nil, ErrUnsupported
   112  }
   113  
   114  // PedersenMulNum Compute a commitment to x * y from a commitment to x and an integer y, without revealing the value x and y
   115  // commitment1: commitment to x: Cx = xB + rB'
   116  // value: integer value y
   117  // return: commitment to x * y: C = (x * y)B + (r * y)B'
   118  func PedersenMulNum(commitment1 []byte, value uint64) ([]byte, error) {
   119  	return nil, ErrUnsupported
   120  }
   121  
   122  // PedersenMulOpening Compute opening1 * integer. Openings are big numbers with 256 bits.
   123  // opening1: the input opening r
   124  // value: the input integer value y
   125  // return: the multiplication r * y as a big number with 256 bits in []byte form
   126  func PedersenMulOpening(opening1 []byte, value uint64) ([]byte, error) {
   127  	return nil, ErrUnsupported
   128  }
   129  
   130  // PedersenMulNumWithOpening Compute a commitment to x * y from a commitment to x and an integer y, without revealing the value x and y
   131  // commitment: commitment to x: Cx = xB + rB'
   132  // opening: opening to Cx: r
   133  // value: integer value y
   134  // return1: commitment to x * y: C = (x * y)B + (r * y)B'
   135  // return2: opening to the result commitment: r * y
   136  func PedersenMulNumWithOpening(commitment []byte, opening []byte, value uint64) ([]byte, []byte, error) {
   137  	return nil, nil, ErrUnsupported
   138  }