diff options
author | Joe Crayne <joe@jerkface.net> | 2019-07-16 10:58:16 -0400 |
---|---|---|
committer | Joe Crayne <joe@jerkface.net> | 2019-07-16 10:58:16 -0400 |
commit | bb3a9e181638fa881e2bcd8425f10cfb365533f5 (patch) | |
tree | 7ce12fa8c0d4232128381c15c06f33dafab25aca /Data | |
parent | d6e03020851601668cf5419950ca0cc49e54c42f (diff) |
Add hex function to curse fingerprints with.
Diffstat (limited to 'Data')
-rw-r--r-- | Data/OpenPGP/Util.hs | 2 | ||||
-rw-r--r-- | Data/OpenPGP/Util/Fingerprint.hs | 7 |
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 @@ | |||
1 | module Data.OpenPGP.Util | 1 | module 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 #-} |
2 | module Data.OpenPGP.Util.Fingerprint (fingerprint,Fingerprint(..)) where | 2 | module Data.OpenPGP.Util.Fingerprint (fingerprint,Fingerprint(..),hex) where |
3 | 3 | ||
4 | import qualified Data.OpenPGP as OpenPGP | 4 | import qualified Data.OpenPGP as OpenPGP |
5 | import qualified Data.ByteString as BS | 5 | import qualified Data.ByteString as BS |
@@ -23,7 +23,10 @@ oo = (.) . (.) | |||
23 | newtype Fingerprint = Fingerprint BS.ByteString | 23 | newtype Fingerprint = Fingerprint BS.ByteString |
24 | 24 | ||
25 | instance Show Fingerprint where | 25 | instance Show Fingerprint where |
26 | show (Fingerprint bs) = hexify bs | 26 | show fp = hex fp |
27 | |||
28 | hex :: Fingerprint -> String | ||
29 | hex (Fingerprint bs) = hexify bs | ||
27 | where | 30 | where |
28 | hexify = map toUpper . hexString . BS.unpack | 31 | hexify = map toUpper . hexString . BS.unpack |
29 | 32 | ||