mirror of
				https://source.quilibrium.com/quilibrium/ceremonyclient.git
				synced 2025-11-04 00:27:41 +00:00 
			
		
		
		
	
		
			
				
	
	
		
			38 lines
		
	
	
		
			930 B
		
	
	
	
		
			Go
		
	
	
	
	
	
			
		
		
	
	
			38 lines
		
	
	
		
			930 B
		
	
	
	
		
			Go
		
	
	
	
	
	
package schnorr
 | 
						|
 | 
						|
import (
 | 
						|
	"crypto/rand"
 | 
						|
	"fmt"
 | 
						|
	"testing"
 | 
						|
 | 
						|
	"github.com/stretchr/testify/require"
 | 
						|
	"golang.org/x/crypto/sha3"
 | 
						|
 | 
						|
	"source.quilibrium.com/quilibrium/monorepo/nekryptology/pkg/core/curves"
 | 
						|
)
 | 
						|
 | 
						|
func TestZKPOverMultipleCurves(t *testing.T) {
 | 
						|
	curveInstances := []*curves.Curve{
 | 
						|
		curves.K256(),
 | 
						|
		curves.P256(),
 | 
						|
		curves.PALLAS(),
 | 
						|
		curves.BLS12377G1(),
 | 
						|
		curves.BLS12377G2(),
 | 
						|
		curves.BLS12381G1(),
 | 
						|
		curves.BLS12381G2(),
 | 
						|
		curves.ED25519(),
 | 
						|
		curves.BLS48581G1(),
 | 
						|
	}
 | 
						|
	for i, curve := range curveInstances {
 | 
						|
		uniqueSessionId := sha3.New256().Sum([]byte("random seed"))
 | 
						|
		prover := NewProver(curve, nil, sha3.New256(), uniqueSessionId)
 | 
						|
 | 
						|
		secret := curve.Scalar.Random(rand.Reader)
 | 
						|
		proof, err := prover.Prove(secret)
 | 
						|
		require.NoError(t, err, fmt.Sprintf("failed in curve %d", i))
 | 
						|
 | 
						|
		err = Verify(proof, curve, nil, sha3.New256(), uniqueSessionId)
 | 
						|
		require.NoError(t, err, fmt.Sprintf("failed in curve %d", i))
 | 
						|
	}
 | 
						|
}
 |