From 36f7bd59a54c39654bd518a1366ea9bdf551b1af Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Fri, 19 Aug 2016 17:08:55 -0400 Subject: fix ordering bug in chunk --- Encryption.hs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'Encryption.hs') diff --git a/Encryption.hs b/Encryption.hs index 5e91ef5..b084c27 100644 --- a/Encryption.hs +++ b/Encryption.hs @@ -46,6 +46,11 @@ data DecryptResult -- ^ Returned when the EncryptedSecretKey is truncated. | DecryptFailed +instance Show DecryptResult where + show (DecryptSuccess _) = "DecryptSuccess" + show (DecryptIncomplete _) = "DecryptIncomplete" + show DecryptFailed = "DecryptFailed" + decrypt :: KeyEncryptionKey -> EncryptedSecretKey -> DecryptResult decrypt kek (EncryptedSecretKey cs _) = case decodeEncryptableBytes pbs of Nothing -> DecryptFailed @@ -146,7 +151,7 @@ chunk :: Int -> B.ByteString -> [B.ByteString] chunk n = go [] where go cs b - | B.length b <= n = b : reverse cs + | B.length b <= n = reverse (b:cs) | otherwise = let (h, t) = B.splitAt n b in go (h:cs) t -- cgit v1.2.3