refactor(crypto): simplify elliptic curve implementation

This commit is contained in:
Prad Nukala
2025-10-09 15:11:59 -04:00
parent a934caa7d3
commit 7d339ae522
205 changed files with 380 additions and 380 deletions
+1 -1
View File
@@ -3,7 +3,7 @@ package bls12381
import (
"math/bits"
"github.com/sonr-io/sonr/crypto/core/curves/native"
"github.com/sonr-io/crypto/core/curves/native"
)
var fqModulusBytes = [native.FieldBytes]byte{
+2 -2
View File
@@ -6,8 +6,8 @@ import (
"io"
"math/big"
"github.com/sonr-io/sonr/crypto/core/curves/native"
"github.com/sonr-io/sonr/crypto/internal"
"github.com/sonr-io/crypto/core/curves/native"
"github.com/sonr-io/crypto/internal"
)
// fp field element mod p
+1 -1
View File
@@ -14,7 +14,7 @@ import (
"github.com/stretchr/testify/require"
"github.com/sonr-io/sonr/crypto/internal"
"github.com/sonr-io/crypto/internal"
)
func TestFpSetOne(t *testing.T) {
+1 -1
View File
@@ -5,7 +5,7 @@ import (
"math/big"
"sync"
"github.com/sonr-io/sonr/crypto/core/curves/native"
"github.com/sonr-io/crypto/core/curves/native"
)
type Fq [native.FieldLimbs]uint64
+2 -2
View File
@@ -14,8 +14,8 @@ import (
"github.com/stretchr/testify/require"
"github.com/sonr-io/sonr/crypto/core/curves/native"
"github.com/sonr-io/sonr/crypto/internal"
"github.com/sonr-io/crypto/core/curves/native"
"github.com/sonr-io/crypto/internal"
)
func TestFqSetOne(t *testing.T) {
+2 -2
View File
@@ -7,8 +7,8 @@ import (
"github.com/pkg/errors"
"github.com/sonr-io/sonr/crypto/core/curves/native"
"github.com/sonr-io/sonr/crypto/internal"
"github.com/sonr-io/crypto/core/curves/native"
"github.com/sonr-io/crypto/internal"
)
var (
+1 -1
View File
@@ -7,7 +7,7 @@ import (
"github.com/stretchr/testify/require"
"github.com/sonr-io/sonr/crypto/core/curves/native"
"github.com/sonr-io/crypto/core/curves/native"
)
func TestG1IsOnCurve(t *testing.T) {
+2 -2
View File
@@ -7,8 +7,8 @@ import (
"github.com/pkg/errors"
"github.com/sonr-io/sonr/crypto/core/curves/native"
"github.com/sonr-io/sonr/crypto/internal"
"github.com/sonr-io/crypto/core/curves/native"
"github.com/sonr-io/crypto/internal"
)
var (
+1 -1
View File
@@ -7,7 +7,7 @@ import (
"github.com/stretchr/testify/require"
"github.com/sonr-io/sonr/crypto/core/curves/native"
"github.com/sonr-io/crypto/core/curves/native"
)
func TestG2IsOnCurve(t *testing.T) {
+2 -2
View File
@@ -3,8 +3,8 @@ package bls12381
import (
"io"
"github.com/sonr-io/sonr/crypto/core/curves/native"
"github.com/sonr-io/sonr/crypto/internal"
"github.com/sonr-io/crypto/core/curves/native"
"github.com/sonr-io/crypto/internal"
)
// GtFieldBytes is the number of bytes needed to represent this field
+1 -1
View File
@@ -6,7 +6,7 @@ import (
"github.com/stretchr/testify/require"
"github.com/sonr-io/sonr/crypto/core/curves/native"
"github.com/sonr-io/crypto/core/curves/native"
)
func TestSinglePairing(t *testing.T) {
+1 -1
View File
@@ -5,7 +5,7 @@ import (
"fmt"
"math/big"
"github.com/sonr-io/sonr/crypto/internal"
"github.com/sonr-io/crypto/internal"
)
// FieldLimbs is the number of limbs needed to represent this field
+1 -1
View File
@@ -10,7 +10,7 @@ import (
"math/big"
"sync"
"github.com/sonr-io/sonr/crypto/core/curves/native"
"github.com/sonr-io/crypto/core/curves/native"
)
var (
+2 -2
View File
@@ -14,8 +14,8 @@ import (
"github.com/stretchr/testify/require"
"github.com/sonr-io/sonr/crypto/core/curves/native"
"github.com/sonr-io/sonr/crypto/internal"
"github.com/sonr-io/crypto/core/curves/native"
"github.com/sonr-io/crypto/internal"
)
func TestFpSetOne(t *testing.T) {
+1 -1
View File
@@ -10,7 +10,7 @@ import (
"math/big"
"sync"
"github.com/sonr-io/sonr/crypto/core/curves/native"
"github.com/sonr-io/crypto/core/curves/native"
)
var (
+2 -2
View File
@@ -14,8 +14,8 @@ import (
"github.com/stretchr/testify/require"
"github.com/sonr-io/sonr/crypto/core/curves/native"
"github.com/sonr-io/sonr/crypto/internal"
"github.com/sonr-io/crypto/core/curves/native"
"github.com/sonr-io/crypto/internal"
)
func TestFqSetOne(t *testing.T) {
+3 -3
View File
@@ -3,9 +3,9 @@ package k256
import (
"sync"
"github.com/sonr-io/sonr/crypto/core/curves/native"
"github.com/sonr-io/sonr/crypto/core/curves/native/k256/fp"
"github.com/sonr-io/sonr/crypto/internal"
"github.com/sonr-io/crypto/core/curves/native"
"github.com/sonr-io/crypto/core/curves/native/k256/fp"
"github.com/sonr-io/crypto/internal"
)
var (
+2 -2
View File
@@ -5,8 +5,8 @@ import (
"github.com/stretchr/testify/require"
"github.com/sonr-io/sonr/crypto/core/curves/native"
"github.com/sonr-io/sonr/crypto/core/curves/native/k256"
"github.com/sonr-io/crypto/core/curves/native"
"github.com/sonr-io/crypto/core/curves/native/k256"
)
func TestK256PointArithmetic_Hash(t *testing.T) {
+1 -1
View File
@@ -10,7 +10,7 @@ import (
"math/big"
"sync"
"github.com/sonr-io/sonr/crypto/core/curves/native"
"github.com/sonr-io/crypto/core/curves/native"
)
var (
+2 -2
View File
@@ -14,8 +14,8 @@ import (
"github.com/stretchr/testify/require"
"github.com/sonr-io/sonr/crypto/core/curves/native"
"github.com/sonr-io/sonr/crypto/internal"
"github.com/sonr-io/crypto/core/curves/native"
"github.com/sonr-io/crypto/internal"
)
func TestFpSetOne(t *testing.T) {
+1 -1
View File
@@ -10,7 +10,7 @@ import (
"math/big"
"sync"
"github.com/sonr-io/sonr/crypto/core/curves/native"
"github.com/sonr-io/crypto/core/curves/native"
)
var (
+2 -2
View File
@@ -14,8 +14,8 @@ import (
"github.com/stretchr/testify/require"
"github.com/sonr-io/sonr/crypto/core/curves/native"
"github.com/sonr-io/sonr/crypto/internal"
"github.com/sonr-io/crypto/core/curves/native"
"github.com/sonr-io/crypto/internal"
)
func TestFqSetOne(t *testing.T) {
+3 -3
View File
@@ -3,9 +3,9 @@ package p256
import (
"sync"
"github.com/sonr-io/sonr/crypto/core/curves/native"
"github.com/sonr-io/sonr/crypto/core/curves/native/p256/fp"
"github.com/sonr-io/sonr/crypto/internal"
"github.com/sonr-io/crypto/core/curves/native"
"github.com/sonr-io/crypto/core/curves/native/p256/fp"
"github.com/sonr-io/crypto/internal"
)
var (
+4 -4
View File
@@ -6,10 +6,10 @@ import (
"github.com/stretchr/testify/require"
"github.com/sonr-io/sonr/crypto/core/curves"
"github.com/sonr-io/sonr/crypto/core/curves/native"
"github.com/sonr-io/sonr/crypto/core/curves/native/p256"
"github.com/sonr-io/sonr/crypto/core/curves/native/p256/fp"
"github.com/sonr-io/crypto/core/curves"
"github.com/sonr-io/crypto/core/curves/native"
"github.com/sonr-io/crypto/core/curves/native/p256"
"github.com/sonr-io/crypto/core/curves/native/p256/fp"
)
func TestP256PointArithmetic_Double(t *testing.T) {
+1 -1
View File
@@ -11,7 +11,7 @@ import (
"fmt"
"math/big"
"github.com/sonr-io/sonr/crypto/internal"
"github.com/sonr-io/crypto/internal"
)
type Fp fiat_pasta_fp_montgomery_domain_field_element
+1 -1
View File
@@ -11,7 +11,7 @@ import (
"fmt"
"math/big"
"github.com/sonr-io/sonr/crypto/internal"
"github.com/sonr-io/crypto/internal"
)
type Fq fiat_pasta_fq_montgomery_domain_field_element