Jacobi computes the Jacobi symbol of (a/M), which indicates whether a is zero (0), a positive square in M (1), or a non-square in M (-1).
(as kyber.Scalar)
| 278 | // Jacobi computes the Jacobi symbol of (a/M), which indicates whether a is |
| 279 | // zero (0), a positive square in M (1), or a non-square in M (-1). |
| 280 | func (i *Int) Jacobi(as kyber.Scalar) kyber.Scalar { |
| 281 | ai := as.(*Int) |
| 282 | i.M = ai.M |
| 283 | i.V.SetInt64(int64(big.Jacobi(&ai.V, i.M))) |
| 284 | return i |
| 285 | } |
| 286 | |
| 287 | // Sqrt computes some square root of a mod M of one exists. |
| 288 | // Assumes the modulus M is an odd prime. |