summaryrefslogtreecommitdiff
path: root/dht/src/Network/Tox/NodeId.hs
diff options
context:
space:
mode:
Diffstat (limited to 'dht/src/Network/Tox/NodeId.hs')
-rw-r--r--dht/src/Network/Tox/NodeId.hs4
1 files changed, 4 insertions, 0 deletions
diff --git a/dht/src/Network/Tox/NodeId.hs b/dht/src/Network/Tox/NodeId.hs
index a3ddd617..d05e3697 100644
--- a/dht/src/Network/Tox/NodeId.hs
+++ b/dht/src/Network/Tox/NodeId.hs
@@ -41,6 +41,7 @@ module Network.Tox.NodeId
41 , showToken32 41 , showToken32
42 , show32Token32 42 , show32Token32
43 , nodeInfoFromJSON 43 , nodeInfoFromJSON
44 , showHexId
44 ) where 45 ) where
45 46
46import Control.Applicative 47import Control.Applicative
@@ -174,6 +175,9 @@ instance S.Serialize NodeId where
174 get = key2id <$> getPublicKey 175 get = key2id <$> getPublicKey
175 put nid = putPublicKey $ id2key nid 176 put nid = putPublicKey $ id2key nid
176 177
178showHexId :: NodeId -> String
179showHexId nid = C8.unpack $ Base16.encode $ BA.convert $ id2key nid
180
177instance Hashable NodeId where 181instance Hashable NodeId where
178 hashWithSalt salt (NodeId ws _) = hashWithSalt salt (head ws) 182 hashWithSalt salt (NodeId ws _) = hashWithSalt salt (head ws)
179 183