summaryrefslogtreecommitdiff
path: root/Data/OpenPGP/Util/Fingerprint.hs
diff options
context:
space:
mode:
Diffstat (limited to 'Data/OpenPGP/Util/Fingerprint.hs')
-rw-r--r--Data/OpenPGP/Util/Fingerprint.hs10
1 files changed, 1 insertions, 9 deletions
diff --git a/Data/OpenPGP/Util/Fingerprint.hs b/Data/OpenPGP/Util/Fingerprint.hs
index cda25f6..955748d 100644
--- a/Data/OpenPGP/Util/Fingerprint.hs
+++ b/Data/OpenPGP/Util/Fingerprint.hs
@@ -2,6 +2,7 @@
2module Data.OpenPGP.Util.Fingerprint (fingerprint,fingerprintv,Fingerprint(..),hex) where 2module Data.OpenPGP.Util.Fingerprint (fingerprint,fingerprintv,Fingerprint(..),hex) where
3 3
4import qualified Data.OpenPGP as OpenPGP 4import qualified Data.OpenPGP as OpenPGP
5import Data.OpenPGP.Internal
5import qualified Data.ByteString as BS 6import qualified Data.ByteString as BS
6import qualified Data.ByteString.Lazy as LZ 7import qualified Data.ByteString.Lazy as LZ
7import Data.Char (toUpper) 8import Data.Char (toUpper)
@@ -28,15 +29,6 @@ instance Show Fingerprint where
28 29
29hex :: Fingerprint -> String 30hex :: Fingerprint -> String
30hex (Fingerprint bs) = hexify bs 31hex (Fingerprint bs) = hexify bs
31 where
32 hexify = map toUpper . hexString . BS.unpack
33
34 hexString :: [Word8] -> String
35 hexString = foldr (pad `oo` showHex) ""
36 where
37 pad s | odd $ length s = '0':s
38 | otherwise = s
39
40 32
41-- | Generate a key fingerprint from a PublicKeyPacket or SecretKeyPacket 33-- | Generate a key fingerprint from a PublicKeyPacket or SecretKeyPacket
42-- <http://tools.ietf.org/html/rfc4880#section-12.2> 34-- <http://tools.ietf.org/html/rfc4880#section-12.2>