File tree 3 files changed +6
-1
lines changed
3 files changed +6
-1
lines changed Original file line number Diff line number Diff line change @@ -45,6 +45,7 @@ type Element interface {
45
45
// Scalar represents an integer scalar.
46
46
type Scalar interface {
47
47
IsEqual (Scalar ) bool
48
+ SetUint64 (uint64 )
48
49
Add (Scalar , Scalar ) Scalar
49
50
Sub (Scalar , Scalar ) Scalar
50
51
Mul (Scalar , Scalar ) Scalar
Original file line number Diff line number Diff line change 4
4
"crypto"
5
5
_ "crypto/sha512" // to link libraries
6
6
"io"
7
+ "math/big"
7
8
8
9
r255 "github.com/bwesterb/go-ristretto"
9
10
)
@@ -145,6 +146,8 @@ func (e *ristrettoElement) UnmarshalBinary(data []byte) error {
145
146
return e .p .UnmarshalBinary (data )
146
147
}
147
148
149
+ func (s * ristrettoScalar ) SetUint64 (n uint64 ) { s .s .SetBigInt (new (big.Int ).SetUint64 (n )) }
150
+
148
151
func (s * ristrettoScalar ) IsEqual (x Scalar ) bool {
149
152
return s .s .Equals (& x .(* ristrettoScalar ).s )
150
153
}
Original file line number Diff line number Diff line change @@ -195,7 +195,8 @@ type wScl struct {
195
195
k []byte
196
196
}
197
197
198
- func (s * wScl ) String () string { return fmt .Sprintf ("0x%x" , s .k ) }
198
+ func (s * wScl ) String () string { return fmt .Sprintf ("0x%x" , s .k ) }
199
+ func (s * wScl ) SetUint64 (n uint64 ) { s .fromBig (new (big.Int ).SetUint64 (n )) }
199
200
func (s * wScl ) IsEqual (a Scalar ) bool {
200
201
aa := s .cvtScl (a )
201
202
return subtle .ConstantTimeCompare (s .k , aa .k ) == 1
You can’t perform that action at this time.
0 commit comments