diff options
-rw-r--r-- | ecc.hs | 6 |
1 files changed, 3 insertions, 3 deletions
@@ -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 |