aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ecc.hs6
1 files changed, 3 insertions, 3 deletions
diff --git a/ecc.hs b/ecc.hs
index 5bc5d8a..42a9220 100644
--- a/ecc.hs
+++ b/ecc.hs
@@ -95,11 +95,11 @@ add p q
in ECPoint new_x new_y (a p) (b p)
-binaryExpansion :: (Eq a, Fractional a) => Integer -> ECPoint a -> ECPoint a -> ECPoint a
+binaryExpansion :: (Semigroup a) => Integer -> a -> a -> a
binaryExpansion m value result | m == 0 = result
- | otherwise = binaryExpansion (m `shiftR` 1) (add value value) accumulator
+ | otherwise = binaryExpansion (m `shiftR` 1) (value <> value) accumulator
where
- accumulator = if m .&. 1 == 1 then add result value else result
+ accumulator = if m .&. 1 == 1 then result <> value else result
scalarProduct :: (Eq a, Fractional a) => Integer -> ECPoint a -> ECPoint a
scalarProduct m ec = binaryExpansion m ec Infinity