Skip to content

Commit

Permalink
Fix endianess bool
Browse files Browse the repository at this point in the history
  • Loading branch information
K1li4nL committed May 14, 2024
1 parent f66c385 commit 05e7ad2
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
7 changes: 4 additions & 3 deletions group/edwards25519/scalar.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import (
// The scalars are GF(2^252 + 27742317777372353535851937790883648493).

var marshalScalarID = [8]byte{'e', 'd', '.', 's', 'c', 'a', 'l', 'a'}
var defaultEndianess = kyber.LittleEndian

type scalar struct {
v [32]byte
Expand Down Expand Up @@ -60,7 +61,7 @@ func (s *scalar) SetInt64(v int64) kyber.Scalar {
}

func (s *scalar) toInt() *mod.Int {
return mod.NewIntBytes(s.v[:], primeOrder, kyber.LittleEndian)
return mod.NewIntBytes(s.v[:], primeOrder, defaultEndianess)
}

// Set to the additive identity (0)
Expand Down Expand Up @@ -140,12 +141,12 @@ func (s *scalar) Pick(rand cipher.Stream) kyber.Scalar {

// SetBytes s to b, interpreted as a little endian integer.
func (s *scalar) SetBytes(b []byte) kyber.Scalar {
return s.setInt(mod.NewIntBytes(b, primeOrder, kyber.LittleEndian))
return s.setInt(mod.NewIntBytes(b, primeOrder, defaultEndianess))
}

// ByteOrder return the byte representation type (big or little endian)
func (s *scalar) ByteOrder() kyber.ByteOrder {
return kyber.LittleEndian
return defaultEndianess
}

// GroupOrder returns the order of the underlying group
Expand Down
2 changes: 1 addition & 1 deletion pairing/bls12381/circl/scalar.go
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ func (s *Scalar) Pick(stream cipher.Stream) kyber.Scalar {
func (s *Scalar) SetBytes(data []byte) kyber.Scalar { s.inner.SetBytes(data); return s }

func (s *Scalar) ByteOrder() kyber.ByteOrder {
return kyber.LittleEndian
return kyber.BigEndian
}

func (s *Scalar) GroupOrder() *big.Int {
Expand Down

0 comments on commit 05e7ad2

Please sign in to comment.