making PRK an instance of ByteArrayAccess and removing fromPRK/toPRK.
This commit is contained in:
parent
f84aa5d7ce
commit
58151b9965
@ -15,8 +15,6 @@ module Crypto.KDF.HKDF
|
|||||||
, extract
|
, extract
|
||||||
, extractSkip
|
, extractSkip
|
||||||
, expand
|
, expand
|
||||||
, fromPRK
|
|
||||||
, toPRK
|
|
||||||
) where
|
) where
|
||||||
|
|
||||||
import Data.Word
|
import Data.Word
|
||||||
@ -29,12 +27,11 @@ import qualified Crypto.Internal.ByteArray as B
|
|||||||
data PRK a = PRK (HMAC a) | PRK_NoExpand ScrubbedBytes
|
data PRK a = PRK (HMAC a) | PRK_NoExpand ScrubbedBytes
|
||||||
deriving (Eq)
|
deriving (Eq)
|
||||||
|
|
||||||
fromPRK :: ByteArray b => PRK a -> b
|
instance ByteArrayAccess (PRK a) where
|
||||||
fromPRK (PRK hm) = B.convert hm
|
length (PRK hm) = B.length hm
|
||||||
fromPRK (PRK_NoExpand sb) = B.convert sb
|
length (PRK_NoExpand sb) = B.length sb
|
||||||
|
withByteArray (PRK hm) = B.withByteArray hm
|
||||||
toPRK :: ByteArrayAccess b => b -> PRK a
|
withByteArray (PRK_NoExpand sb) = B.withByteArray sb
|
||||||
toPRK = extractSkip
|
|
||||||
|
|
||||||
-- | Extract a Pseudo Random Key using the parameter and the underlaying hash mechanism
|
-- | Extract a Pseudo Random Key using the parameter and the underlaying hash mechanism
|
||||||
extract :: (HashAlgorithm a, ByteArrayAccess salt, ByteArrayAccess ikm)
|
extract :: (HashAlgorithm a, ByteArrayAccess salt, ByteArrayAccess ikm)
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user