summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoe Crayne <joe@jerkface.net>2019-07-16 10:58:16 -0400
committerJoe Crayne <joe@jerkface.net>2019-07-16 10:58:16 -0400
commitbb3a9e181638fa881e2bcd8425f10cfb365533f5 (patch)
tree7ce12fa8c0d4232128381c15c06f33dafab25aca
parentd6e03020851601668cf5419950ca0cc49e54c42f (diff)
Add hex function to curse fingerprints with.
-rw-r--r--Data/OpenPGP/Util.hs2
-rw-r--r--Data/OpenPGP/Util/Fingerprint.hs7
2 files changed, 7 insertions, 2 deletions
diff --git a/Data/OpenPGP/Util.hs b/Data/OpenPGP/Util.hs
index 1f9277d..1781d6d 100644
--- a/Data/OpenPGP/Util.hs
+++ b/Data/OpenPGP/Util.hs
@@ -1,5 +1,7 @@
1module Data.OpenPGP.Util 1module Data.OpenPGP.Util
2 ( fingerprint 2 ( fingerprint
3 , Fingerprint(..)
4 , hex
3 , decryptSecretKey 5 , decryptSecretKey
4 , encryptSecretKey 6 , encryptSecretKey
5 , verify 7 , verify
diff --git a/Data/OpenPGP/Util/Fingerprint.hs b/Data/OpenPGP/Util/Fingerprint.hs
index b2e3904..c1d8fef 100644
--- a/Data/OpenPGP/Util/Fingerprint.hs
+++ b/Data/OpenPGP/Util/Fingerprint.hs
@@ -1,5 +1,5 @@
1{-# LANGUAGE CPP #-} 1{-# LANGUAGE CPP #-}
2module Data.OpenPGP.Util.Fingerprint (fingerprint,Fingerprint(..)) where 2module Data.OpenPGP.Util.Fingerprint (fingerprint,Fingerprint(..),hex) where
3 3
4import qualified Data.OpenPGP as OpenPGP 4import qualified Data.OpenPGP as OpenPGP
5import qualified Data.ByteString as BS 5import qualified Data.ByteString as BS
@@ -23,7 +23,10 @@ oo = (.) . (.)
23newtype Fingerprint = Fingerprint BS.ByteString 23newtype Fingerprint = Fingerprint BS.ByteString
24 24
25instance Show Fingerprint where 25instance Show Fingerprint where
26 show (Fingerprint bs) = hexify bs 26 show fp = hex fp
27
28hex :: Fingerprint -> String
29hex (Fingerprint bs) = hexify bs
27 where 30 where
28 hexify = map toUpper . hexString . BS.unpack 31 hexify = map toUpper . hexString . BS.unpack
29 32