Div sets the target to a * b^-1 mod M, where b^-1 is the modular inverse of b.
(a, b kyber.Scalar)
| 246 | |
| 247 | // Div sets the target to a * b^-1 mod M, where b^-1 is the modular inverse of b. |
| 248 | func (i *Int) Div(a, b kyber.Scalar) kyber.Scalar { |
| 249 | ai := a.(*Int) |
| 250 | bi := b.(*Int) |
| 251 | var t big.Int |
| 252 | i.M = ai.M |
| 253 | i.V.Mul(&ai.V, t.ModInverse(&bi.V, i.M)) |
| 254 | i.V.Mod(&i.V, i.M) |
| 255 | return i |
| 256 | } |
| 257 | |
| 258 | // Inv sets the target to the modular inverse of a with respect to modulus M. |
| 259 | func (i *Int) Inv(a kyber.Scalar) kyber.Scalar { |