summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorPiyush P Kurur <ppk@cse.iitk.ac.in>2017-03-04 22:51:23 +0530
committerPiyush P Kurur <ppk@cse.iitk.ac.in>2017-03-21 12:05:44 +0530
commitfb3376eb5b3ba2e139102f04c9eaa4d7cf4b4646 (patch)
tree1e1ad13bbc833e9a4a77d3e2d530967910987944
parentf06692d75041bd646539eb79f4809666038d8f5b (diff)
downloadkeysafe-fb3376eb5b3ba2e139102f04c9eaa4d7cf4b4646.tar.gz
small improvement on encoding using sha.
-rw-r--r--Encryption.hs4
1 files changed, 3 insertions, 1 deletions
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