summaryrefslogtreecommitdiffhomepage
path: root/Encryption.hs
diff options
context:
space:
mode:
authorSean Whitton <spwhitton@spwhitton.name>2017-08-16 11:41:25 -0700
committerSean Whitton <spwhitton@spwhitton.name>2017-08-16 11:41:25 -0700
commit379f036b39e0f7dac360ba04b281f6ea4ce8f20e (patch)
tree01a86517d6234562088561c3c4b51365ed722807 /Encryption.hs
parent680449e656820db2b899a8631060cf62359b9b74 (diff)
parent0229f026b1ae0344c4c052593564800035268d81 (diff)
downloadkeysafe-379f036b39e0f7dac360ba04b281f6ea4ce8f20e.tar.gz
Merge tag '0.20170811'
tagging package keysafe version 0.20170811 # gpg: Signature made Fri 11 Aug 2017 03:58:54 PM MST # gpg: using RSA key 28A500C35207EAB72F6C0F25DB12DB0FF05F8F38 # gpg: Good signature from "Joey Hess <joeyh@joeyh.name>" [full] # Primary key fingerprint: E85A 5F63 B31D 24C1 EBF0 D81C C910 D922 2512 E3C7 # Subkey fingerprint: 28A5 00C3 5207 EAB7 2F6C 0F25 DB12 DB0F F05F 8F38
Diffstat (limited to 'Encryption.hs')
-rw-r--r--Encryption.hs6
1 files changed, 4 insertions, 2 deletions
diff --git a/Encryption.hs b/Encryption.hs
index 3e085a0..3748edf 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
@@ -202,7 +201,10 @@ 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