From f91665a56dd8018887e55870a313b7a45841d891 Mon Sep 17 00:00:00 2001 From: Stephen Paul Weber Date: Mon, 1 Aug 2011 16:36:28 -0500 Subject: Fix MPI put --- lib/OpenPGP.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/OpenPGP.hs b/lib/OpenPGP.hs index 57f83c5..a87b3e9 100644 --- a/lib/OpenPGP.hs +++ b/lib/OpenPGP.hs @@ -109,7 +109,7 @@ instance Binary Message where newtype MPI = MPI Integer deriving (Show, Read, Eq, Ord) instance Binary MPI where put (MPI i) = do - put ((((fromIntegral (LZ.length bytes)) - 1) * 8) + (floor (logBase 2 (fromIntegral (bytes `LZ.index` 1)))) + 1 :: Word16) + put ((((fromIntegral (LZ.length bytes)) - 1) * 8) + (floor (logBase 2 (fromIntegral (bytes `LZ.index` 0)))) + 1 :: Word16) mapM (\x -> putWord8 x) (LZ.unpack bytes) put () where bytes = LZ.unfoldr (\x -> if x == 0 then Nothing else Just (fromIntegral x, x `shiftR` 8)) i -- cgit v1.2.3