diff options
Diffstat (limited to 'Hash.hs')
-rw-r--r-- | Hash.hs | 20 |
1 files changed, 13 insertions, 7 deletions
@@ -38,10 +38,6 @@ instance Hashable a => Hashable (Activity a) where hash (Activity a mp s) = hash $ Tagged "Activity" [hash a, hash mp, hash s] -instance Hashable a => Hashable (Proto a) where - hash (Proto a) = hash $ Tagged "Proto" a - hash (Rejected a) = hash $ Tagged "Rejected" (hash a) - instance Hashable Entered where hash v = hash $ Tagged "Entered" [hash (enteredData v), hash (echoData v)] @@ -50,8 +46,15 @@ instance Hashable Seen where hash v = hash $ Tagged "Seen" [hash (seenData v)] instance Hashable Signature where - hash (Ed25519 s) = hash $ Tagged "Ed25519" s - hash Unsigned = hash $ Tagged "Unsigned" (mempty :: B.ByteString) + hash (Ed25519Signature s) = hash $ Tagged "Ed25519Signature" s + hash (OtherSignature s) = hash $ Tagged "OtherSignature" s + +instance Hashable PublicKey where + hash (PublicKey v gpgsig) = hash $ Tagged "PublicKey" + [hash v, hash gpgsig] + +instance Hashable GpgSig where + hash (GpgSig v) = hash $ Tagged "GpgSig" v -- | Hash a list of hashes by hashing the concacenation of the hashes. instance Hashable [Hash] where @@ -59,5 +62,8 @@ instance Hashable [Hash] where -- | Hash empty string for Nothing instance Hashable v => Hashable (Maybe v) where - hash Nothing = hash (mempty :: B.ByteString) + hash Nothing = hash () hash (Just v) = hash v + +instance Hashable () where + hash () = hash (mempty :: B.ByteString) |