-
Notifications
You must be signed in to change notification settings - Fork 155
/
Crypto.hs
45 lines (39 loc) · 1.1 KB
/
Crypto.hs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE TypeOperators #-}
-- | Package all the crypto constraints into one place.
module Cardano.Ledger.Crypto where
import Cardano.Crypto.DSIGN
import Cardano.Crypto.Hash
import Cardano.Crypto.KES
import Cardano.Crypto.VRF
import Cardano.Crypto.VRF.Praos
import Data.Kind (Type)
import Data.Typeable (Typeable)
class
( HashAlgorithm (HASH c)
, HashAlgorithm (ADDRHASH c)
, DSIGNAlgorithm (DSIGN c)
, KESAlgorithm (KES c)
, VRFAlgorithm (VRF c)
, ContextDSIGN (DSIGN c) ~ ()
, ContextKES (KES c) ~ ()
, ContextVRF (VRF c) ~ ()
, Typeable c
) =>
Crypto c
where
type HASH c :: Type
type ADDRHASH c :: Type
type DSIGN c :: Type
type KES c :: Type
type VRF c :: Type
-- ================================
-- | The same crypto used on the net
data StandardCrypto
instance Crypto StandardCrypto where
type DSIGN StandardCrypto = Ed25519DSIGN
type KES StandardCrypto = Sum6KES Ed25519DSIGN Blake2b_256
type VRF StandardCrypto = PraosVRF
type HASH StandardCrypto = Blake2b_256
type ADDRHASH StandardCrypto = Blake2b_224