Skip to content

Commit 72a891b

Browse files
authored
Ecgfp5 scalar field check correction (#25)
1 parent 2bd6a31 commit 72a891b

File tree

1 file changed

+1
-10
lines changed

1 file changed

+1
-10
lines changed

curve/ecgfp5/scalar_field.go

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ import (
55
"encoding/binary"
66
"math/big"
77

8-
"github.com/elliottech/poseidon_crypto/field/goldilocks"
98
gFp5 "github.com/elliottech/poseidon_crypto/field/goldilocks_quintic_extension"
109
. "github.com/elliottech/poseidon_crypto/int"
1110
)
@@ -15,15 +14,7 @@ import (
1514
type ECgFp5Scalar [5]uint64
1615

1716
func (s ECgFp5Scalar) IsCanonical() bool {
18-
for _, elem := range s {
19-
if elem >= goldilocks.ORDER {
20-
return false
21-
}
22-
}
23-
if ToNonCanonicalBigInt(s).Cmp(ORDER) >= 0 {
24-
return false
25-
}
26-
return true
17+
return ToNonCanonicalBigInt(s).Cmp(ORDER) < 0
2718
}
2819

2920
var (

0 commit comments

Comments
 (0)