diff options
author | Joey Hess <joeyh@joeyh.name> | 2016-08-19 17:08:55 -0400 |
---|---|---|
committer | Joey Hess <joeyh@joeyh.name> | 2016-08-19 17:08:55 -0400 |
commit | 36f7bd59a54c39654bd518a1366ea9bdf551b1af (patch) | |
tree | 713159baab8f8291b392665cb72ee292c5b7e398 /Encryption.hs | |
parent | 6b3253bfabeb2e170c8dada9f5c22718d23e018a (diff) | |
download | keysafe-36f7bd59a54c39654bd518a1366ea9bdf551b1af.tar.gz |
fix ordering bug in chunk
Diffstat (limited to 'Encryption.hs')
-rw-r--r-- | Encryption.hs | 7 |
1 files changed, 6 insertions, 1 deletions
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 |