diff options
author | Óscar Nájera <hi@oscarnajera.com> | 2021-04-05 19:24:51 +0200 |
---|---|---|
committer | Óscar Nájera <hi@oscarnajera.com> | 2021-04-05 19:24:51 +0200 |
commit | bc0120183d4d3852af87deb58f81c6c31c3d6388 (patch) | |
tree | 31b8a96eac6d2425e109511a478a3f2c33118409 | |
parent | c9d3b981cd56d14450c2078980861153dd4920cc (diff) | |
download | programmingbitcoin-bc0120183d4d3852af87deb58f81c6c31c3d6388.tar.gz programmingbitcoin-bc0120183d4d3852af87deb58f81c6c31c3d6388.tar.bz2 programmingbitcoin-bc0120183d4d3852af87deb58f81c6c31c3d6388.zip |
Implement division
-rw-r--r-- | ecc.hs | 4 |
1 files changed, 4 insertions, 0 deletions
@@ -25,6 +25,10 @@ instance Num FieldElement where negate (FieldElement a b) = FieldElement (mod (b - a) b) b fromInteger _ = error "can't transform" +instance Fractional FieldElement where + recip a = a ^ (prime a - 2) + fromRational _ = error "can't transform" + aa = let a = FieldElement 2 31 b = FieldElement 15 31 |