summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStephen Paul Weber <singpolyma@singpolyma.net>2011-08-01 16:36:28 -0500
committerStephen Paul Weber <singpolyma@singpolyma.net>2011-08-01 16:36:28 -0500
commitf91665a56dd8018887e55870a313b7a45841d891 (patch)
tree75e50a41a9ab56a3cb62fe2896f554b31fce301c
parent608b8430864306480af1eeac0dd326db4b187643 (diff)
Fix MPI put
-rw-r--r--lib/OpenPGP.hs2
1 files changed, 1 insertions, 1 deletions
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
109newtype MPI = MPI Integer deriving (Show, Read, Eq, Ord) 109newtype MPI = MPI Integer deriving (Show, Read, Eq, Ord)
110instance Binary MPI where 110instance Binary MPI where
111 put (MPI i) = do 111 put (MPI i) = do
112 put ((((fromIntegral (LZ.length bytes)) - 1) * 8) + (floor (logBase 2 (fromIntegral (bytes `LZ.index` 1)))) + 1 :: Word16) 112 put ((((fromIntegral (LZ.length bytes)) - 1) * 8) + (floor (logBase 2 (fromIntegral (bytes `LZ.index` 0)))) + 1 :: Word16)
113 mapM (\x -> putWord8 x) (LZ.unpack bytes) 113 mapM (\x -> putWord8 x) (LZ.unpack bytes)
114 put () 114 put ()
115 where bytes = LZ.unfoldr (\x -> if x == 0 then Nothing else Just (fromIntegral x, x `shiftR` 8)) i 115 where bytes = LZ.unfoldr (\x -> if x == 0 then Nothing else Just (fromIntegral x, x `shiftR` 8)) i