fixed

Pure Haskell large fixed-width integers and Montgomery arithmetic.
git clone git://git.ppad.tech/fixed.git
Log | Files | Refs | README | LICENSE

commit fd8ecca55626601b8c55357966519ad2fb426888
parent 1e35ce96de54ef1980f87a5318eef3c2be9227de
Author: Jared Tobin <jared@jtobin.io>
Date:   Fri, 19 Dec 2025 12:19:38 -0330

bench: add sqrt to weight

Diffstat:
Mbench/Weight.hs | 10++++++++++
1 file changed, 10 insertions(+), 0 deletions(-)

diff --git a/bench/Weight.hs b/bench/Weight.hs @@ -4,6 +4,7 @@ module Main where +import Prelude hiding (sqrt) import qualified Numeric.Montgomery.Secp256k1.Curve as C import qualified Numeric.Montgomery.Secp256k1.Scalar as S import Weigh @@ -16,6 +17,7 @@ main = mainWith $ do mul sqr inv + sqrt redc retr @@ -83,6 +85,14 @@ inv = func "scalar: M(2) ^ -1" S.inv s2 func "scalar: M(2 ^ 255 - 19) ^ -1" S.inv s_big +sqrt :: Weigh () +sqrt = + let !c2 = 2 :: C.Montgomery + !c_big = (2 ^ 255 - 19) :: C.Montgomery + in wgroup "sqrt" $ do + func "curve: sqrt M(2)" C.sqrt c2 + func "curve: sqrt M(2 ^ 255 - 19)" C.sqrt c_big + redc :: Weigh () redc = let !c2 = 2 :: C.Montgomery