mirror of https://github.com/gtank/ristretto255
ristretto255: add Scalar.Invert
This commit is contained in:
parent
bd32259391
commit
760f82e79e
|
@ -45,6 +45,14 @@ func (s *Scalar) Multiply(x, y *Scalar) *Scalar {
|
||||||
return s
|
return s
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Invert sets s = 1 / x such that s * x = 1 mod l and returns s.
|
||||||
|
//
|
||||||
|
// If x is 0, the result is undefined.
|
||||||
|
func (s *Scalar) Invert(x *Scalar) *Scalar {
|
||||||
|
s.s.Inv(&x.s)
|
||||||
|
return s
|
||||||
|
}
|
||||||
|
|
||||||
// FromUniformBytes sets s to an uniformly distributed value given 64 uniformly
|
// FromUniformBytes sets s to an uniformly distributed value given 64 uniformly
|
||||||
// distributed random bytes.
|
// distributed random bytes.
|
||||||
func (s *Scalar) FromUniformBytes(x []byte) *Scalar {
|
func (s *Scalar) FromUniformBytes(x []byte) *Scalar {
|
||||||
|
|
Loading…
Reference in New Issue