diff options
-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 |