summaryrefslogtreecommitdiff
path: root/Data
diff options
context:
space:
mode:
authorStephen Paul Weber <singpolyma@singpolyma.net>2011-08-12 21:02:53 -0500
committerStephen Paul Weber <singpolyma@singpolyma.net>2011-08-12 21:02:53 -0500
commit531dc4a28554ceaaa495aa02374b559721aa6a9a (patch)
tree185d7c528d74ac981733614c3f863a61c3f1299f /Data
parent779e92b81130213dc5d79b0acafe37e7ee5b45e5 (diff)
Was encoding/reading MPI backwards
Diffstat (limited to 'Data')
-rw-r--r--Data/OpenPGP.hs4
1 files changed, 2 insertions, 2 deletions
diff --git a/Data/OpenPGP.hs b/Data/OpenPGP.hs
index aded330..3693d06 100644
--- a/Data/OpenPGP.hs
+++ b/Data/OpenPGP.hs
@@ -513,12 +513,12 @@ instance Binary MPI where
513 + floor (logBase (2::Double) $ fromIntegral (bytes `LZ.index` 0)) 513 + floor (logBase (2::Double) $ fromIntegral (bytes `LZ.index` 0))
514 + 1 :: Word16) 514 + 1 :: Word16)
515 putLazyByteString bytes 515 putLazyByteString bytes
516 where bytes = LZ.unfoldr (\x -> if x == 0 then Nothing 516 where bytes = LZ.reverse $ LZ.unfoldr (\x -> if x == 0 then Nothing
517 else Just (fromIntegral x, x `shiftR` 8)) i 517 else Just (fromIntegral x, x `shiftR` 8)) i
518 get = do 518 get = do
519 length <- fmap fromIntegral (get :: Get Word16) 519 length <- fmap fromIntegral (get :: Get Word16)
520 bytes <- getLazyByteString ((length + 7) `div` 8) 520 bytes <- getLazyByteString ((length + 7) `div` 8)
521 return (MPI (LZ.foldr (\b a -> 521 return (MPI (LZ.foldl (\a b ->
522 a `shiftL` 8 .|. fromIntegral b) 0 bytes)) 522 a `shiftL` 8 .|. fromIntegral b) 0 bytes))
523 523
524data SignatureSubpacket = 524data SignatureSubpacket =