Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 16 additions & 15 deletions core/vm/privacy/ringct.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,10 @@ import (
"encoding/binary"
"errors"
"fmt"
"github.com/XinFinOrg/XDPoSChain/common"
"math/big"

"github.com/XinFinOrg/XDPoSChain/common"

"github.com/XinFinOrg/XDPoSChain/crypto"
"github.com/XinFinOrg/XDPoSChain/log"
)
Expand All @@ -28,18 +29,18 @@ const (
pubkeyHybrid byte = 0x6 // y_bit + x coord + y coord
)

//The proof contains pretty much stuffs
//The proof contains pretty much stuffs
//Ring size rs: 1 byte => proof[0]
//num input: number of real inputs: 1 byte => proof[1]
//List of inputs/UTXO index typed uint64 => total size = rs * numInput * 8 = proof[0]*proof[1]*8
//List of key images: total size = numInput * 33 = proof[1] * 33
//number of output n: 1 byte
//List of output => n * 130 bytes
//transaction fee: uint256 => 32 byte
//ringCT proof size ctSize: uint16 => 2 byte
//ringCT proof: ctSize bytes
//bulletproofs: bp
// The proof contains pretty much stuffs
// The proof contains pretty much stuffs
// Ring size rs: 1 byte => proof[0]
// num input: number of real inputs: 1 byte => proof[1]
// List of inputs/UTXO index typed uint64 => total size = rs * numInput * 8 = proof[0]*proof[1]*8
// List of key images: total size = numInput * 33 = proof[1] * 33
// number of output n: 1 byte
// List of output => n * 130 bytes
// transaction fee: uint256 => 32 byte
// ringCT proof size ctSize: uint16 => 2 byte
// ringCT proof: ctSize bytes
// bulletproofs: bp
type PrivateSendVerifier struct {
proof []byte
//ringCT RingCT
Expand Down Expand Up @@ -273,7 +274,7 @@ func GenNewKeyRing(size int, privkey *ecdsa.PrivateKey, s int) ([]*ecdsa.PublicK
ring := make([]*ecdsa.PublicKey, size)
pubkey := privkey.Public().(*ecdsa.PublicKey)

if s > len(ring) {
if s >= len(ring) {
return nil, errors.New("index s out of bounds")
}

Expand Down Expand Up @@ -545,7 +546,7 @@ func Link(sig_a *RingSignature, sig_b *RingSignature) bool {
return false
}

//function returns(mutiple rings, private keys, message, error)
// function returns(mutiple rings, private keys, message, error)
func GenerateMultiRingParams(numRing int, ringSize int, s int) (rings []Ring, privkeys []*ecdsa.PrivateKey, m [32]byte, err error) {
for i := 0; i < numRing; i++ {
privkey, err := crypto.GenerateKey()
Expand Down