commit 621556047e01e29e7c36fa9c06d159cd952640ed
parent 47485a53cbe569a40736140c8f3fd9cf7bb3b596
Author: Jared Tobin <jared@jtobin.io>
Date: Sat, 6 Dec 2025 10:33:38 +0400
lib: render montgomery
Diffstat:
1 file changed, 6 insertions(+), 0 deletions(-)
diff --git a/lib/Numeric/Montgomery/Secp256k1/Curve.hs b/lib/Numeric/Montgomery/Secp256k1/Curve.hs
@@ -24,6 +24,7 @@ import qualified Data.Word.Limb as L
import qualified Data.Word.Wide as W
import Data.Word.Wider (Wider(..))
import qualified Data.Word.Wider as WW
+import GHC.Exts (Word(..))
import Prelude hiding (div, mod, or, and, not, quot, rem, recip)
-- montgomery arithmetic, specialized to the secp256k1 field prime modulus
@@ -31,6 +32,11 @@ import Prelude hiding (div, mod, or, and, not, quot, rem, recip)
data Montgomery = Montgomery !(# Limb, Limb, Limb, Limb #)
+render :: Montgomery -> String
+render (Montgomery (# Limb a, Limb b, Limb c, Limb d #)) =
+ "(" <> show (W# a) <> ", " <> show (W# b) <> ", "
+ <> show (W# c) <> ", " <> show (W# d) <> ")"
+
instance Show Montgomery where
show = show . from