update sqrtF2m

This commit is contained in:
Will Song 2020-06-08 10:16:42 -05:00
parent 17336857c5
commit f64efafbad

View File

@ -144,7 +144,9 @@ powF2m' fx a b
sqrtF2m :: BinaryPolynomial -- ^Modulus
-> Integer -- ^a
-> Integer
sqrtF2m fx a = powF2m fx a (2 ^ (log2 fx - 1))
sqrtF2m fx a = go (log2 fx - 1) a
where go 0 x = x
go n x = go (n - 1) (squareF2m fx x)
-- | Extended GCD algorithm for polynomials. For @a@ and @b@ returns @(g, u, v)@ such that @a * u + b * v == g@.
--