mirror of
https://github.com/sonr-io/crypto.git
synced 2026-08-02 23:41:37 +00:00
refactor(crypto): simplify elliptic curve implementation
This commit is contained in:
@@ -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{
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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 (
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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 (
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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 (
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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 (
|
||||
|
||||
@@ -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,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 (
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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 (
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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 (
|
||||
|
||||
@@ -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,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 (
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user