hmac-drbg

Pure Haskell HMAC-DRBG (docs.ppad.tech/hmac-drbg).
git clone git://git.ppad.tech/hmac-drbg.git
Log | Files | Refs | README | LICENSE

Internal.hs (748B)


      1 {-# OPTIONS_HADDOCK hide #-}
      2 
      3 -- |
      4 -- Module: Crypto.DRBG.HMAC.Internal
      5 -- Copyright: (c) 2024 Jared Tobin
      6 -- License: MIT
      7 -- Maintainer: Jared Tobin <jared@ppad.tech>
      8 --
      9 -- Internal HMAC-DRBG definitions.
     10 
     11 module Crypto.DRBG.HMAC.Internal (
     12     Error(..)
     13   , _RESEED_COUNTER
     14   , _MAX_BYTES
     15   ) where
     16 
     17 import Data.Word (Word64)
     18 
     19 -- | A DRBG error.
     20 data Error =
     21     MaxBytesExceeded -- ^ More than 65536 bytes have been requested.
     22   | ReseedRequired   -- ^ The DRBG must be reseeded (via 'reseed').
     23   deriving (Eq, Show)
     24 
     25 -- see SP 800-90A table 2
     26 _RESEED_COUNTER :: Word64
     27 _RESEED_COUNTER = (2 :: Word64) ^ (48 :: Word64)
     28 {-# INLINE _RESEED_COUNTER #-}
     29 
     30 -- see SP 800-90A table 2
     31 _MAX_BYTES :: Word64
     32 _MAX_BYTES = 0x10000
     33 {-# INLINE _MAX_BYTES #-}