Skip to content

Commit

Permalink
Add functions to convert hashes to and from VRFVerKeyHash
Browse files Browse the repository at this point in the history
  • Loading branch information
neilmayhew committed Dec 3, 2024
1 parent 730c811 commit c3e1728
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion libs/cardano-ledger-core/src/Cardano/Ledger/Keys/Internal.hs
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ module Cardano.Ledger.Keys.Internal (
KeyRoleVRF (..),
VRFVerKeyHash (..),
hashVerKeyVRF,
toVRFVerKeyHash,
fromVRFVerKeyHash,

-- * Genesis delegations
GenDelegPair (..),
Expand Down Expand Up @@ -373,4 +375,12 @@ deriving newtype instance Crypto c => Default (VRFVerKeyHash r c)

hashVerKeyVRF ::
Crypto c => VerKeyVRF c -> VRFVerKeyHash (r :: KeyRoleVRF) c
hashVerKeyVRF = VRFVerKeyHash . Hash.castHash . VRF.hashVerKeyVRF
hashVerKeyVRF = toVRFVerKeyHash . VRF.hashVerKeyVRF

toVRFVerKeyHash ::
Hash.Hash (HASH c) (VRF.VerKeyVRF v) -> VRFVerKeyHash (r :: KeyRoleVRF) c
toVRFVerKeyHash = VRFVerKeyHash . Hash.castHash

fromVRFVerKeyHash ::
VRFVerKeyHash (r :: KeyRoleVRF) c -> Hash.Hash (HASH c) (VRF.VerKeyVRF v)
fromVRFVerKeyHash = Hash.castHash . unVRFVerKeyHash

0 comments on commit c3e1728

Please sign in to comment.