diff options
author | Stephen Paul Weber <singpolyma@singpolyma.net> | 2011-08-01 16:36:28 -0500 |
---|---|---|
committer | Stephen Paul Weber <singpolyma@singpolyma.net> | 2011-08-01 16:36:28 -0500 |
commit | f91665a56dd8018887e55870a313b7a45841d891 (patch) | |
tree | 75e50a41a9ab56a3cb62fe2896f554b31fce301c | |
parent | 608b8430864306480af1eeac0dd326db4b187643 (diff) |
Fix MPI put
-rw-r--r-- | lib/OpenPGP.hs | 2 |
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 | |||
109 | newtype MPI = MPI Integer deriving (Show, Read, Eq, Ord) | 109 | newtype MPI = MPI Integer deriving (Show, Read, Eq, Ord) |
110 | instance Binary MPI where | 110 | instance 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 |