Fix DSA test generation.
This commit is contained in:
@@ -6,15 +6,23 @@ module Database(
|
||||
)
|
||||
where
|
||||
|
||||
import "cryptonite" Crypto.Random(DRG(..),SystemDRG)
|
||||
import "crypto-api" Crypto.Random(CryptoRandomGen(..),SystemRandom)
|
||||
import "cryptonite" Crypto.Random(DRG(..))
|
||||
import Data.ByteArray(convert)
|
||||
import Data.Bits(shiftL,testBit)
|
||||
import qualified Data.ByteString as S
|
||||
import Data.Map.Strict(Map)
|
||||
import qualified Data.Map.Strict as Map
|
||||
|
||||
type Database = (Map String [Integer], SystemDRG)
|
||||
type Database = (Map String [Integer], SystemRandom)
|
||||
|
||||
emptyDatabase :: SystemDRG -> Database
|
||||
instance DRG SystemRandom where
|
||||
randomBytesGenerate x g =
|
||||
case genBytes x g of
|
||||
Left e -> error ("Data generation error: " ++ show e)
|
||||
Right (res, g') -> (convert res, g')
|
||||
|
||||
emptyDatabase :: SystemRandom -> Database
|
||||
emptyDatabase g0 = (Map.empty, g0)
|
||||
|
||||
generateNum :: Database -> String -> Int -> (Integer, Database)
|
||||
|
||||
Reference in New Issue
Block a user