add some Show and Eq instances

This commit is contained in:
Vincent Hanquez 2014-01-27 03:50:04 +00:00
parent 51d9c999f0
commit ad6ed6beac

View file

@ -58,12 +58,26 @@ data Bulk = Bulk
, bulkF :: BulkFunctions
}
instance Show Bulk where
show bulk = bulkName bulk
instance Eq Bulk where
b1 == b2 = and [ bulkName b1 == bulkName b2
, bulkKeySize b1 == bulkKeySize b2
, bulkIVSize b1 == bulkIVSize b2
, bulkBlockSize b1 == bulkBlockSize b2
]
data Hash = Hash
{ hashName :: String
, hashSize :: Int
, hashF :: B.ByteString -> B.ByteString
}
instance Show Hash where
show hash = hashName hash
instance Eq Hash where
h1 == h2 = hashName h1 == hashName h2 && hashSize h1 == hashSize h2
-- | Cipher algorithm
data Cipher = Cipher
{ cipherID :: CipherID