From fb3376eb5b3ba2e139102f04c9eaa4d7cf4b4646 Mon Sep 17 00:00:00 2001 From: Piyush P Kurur Date: Sat, 4 Mar 2017 22:51:23 +0530 Subject: small improvement on encoding using sha. --- Encryption.hs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'Encryption.hs') diff --git a/Encryption.hs b/Encryption.hs index 3e085a0..be1e398 100644 --- a/Encryption.hs +++ b/Encryption.hs @@ -202,7 +202,9 @@ encodeEncryptableBytes tunables content = EncryptableBytes $ -- | Encoded, so that it does not contain any NULs. sha :: B.ByteString -> B.ByteString -sha = BU8.fromString . Raaz.showBase16 . Raaz.sha256 +sha = Raaz.toByteString . enc . Raaz.sha256 + where enc :: Raaz.Encodable a => a -> Raaz.Base16 + enc = Raaz.encode padBytes :: Int -> B.ByteString -> B.ByteString padBytes n b = b <> padding -- cgit v1.2.3 From 4f38d369b9ac2237e64feef34a53640cc622c08a Mon Sep 17 00:00:00 2001 From: Piyush P Kurur Date: Sat, 4 Mar 2017 22:54:08 +0530 Subject: removed unwanted module import. --- Encryption.hs | 1 - 1 file changed, 1 deletion(-) (limited to 'Encryption.hs') diff --git a/Encryption.hs b/Encryption.hs index be1e398..6c51e63 100644 --- a/Encryption.hs +++ b/Encryption.hs @@ -20,7 +20,6 @@ import qualified Raaz.Cipher.Internal as Raaz import qualified Data.Text.Encoding as E import qualified Data.ByteString as B import qualified Data.ByteString.Char8 as B8 -import qualified Data.ByteString.UTF8 as BU8 import Text.Read type AesKey = Raaz.KEY256 -- cgit v1.2.3 From e9366e61e6108feba8db68df486961c58a442ff5 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Tue, 21 Mar 2017 10:12:57 -0400 Subject: layout --- Encryption.hs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'Encryption.hs') diff --git a/Encryption.hs b/Encryption.hs index 6c51e63..3748edf 100644 --- a/Encryption.hs +++ b/Encryption.hs @@ -202,8 +202,9 @@ encodeEncryptableBytes tunables content = EncryptableBytes $ -- | Encoded, so that it does not contain any NULs. sha :: B.ByteString -> B.ByteString sha = Raaz.toByteString . enc . Raaz.sha256 - where enc :: Raaz.Encodable a => a -> Raaz.Base16 - enc = Raaz.encode + where + enc :: Raaz.Encodable a => a -> Raaz.Base16 + enc = Raaz.encode padBytes :: Int -> B.ByteString -> B.ByteString padBytes n b = b <> padding -- cgit v1.2.3