Hoogle Search
Within LTS Haskell 24.63 (ghc-9.10.3)
Note that Stackage only displays results for the latest LTS and Nightly snapshot. Learn more.
isPointValid :: Curve -> Point -> Boolcrypton Crypto.PubKey.ECC.Prim check if a point is on specific curve This perform three checks:
- x is not out of range
- y is not out of range
- the equation y^2 = x^3 + a*x + b (mod p) holds
scalarIsValid :: EllipticCurveECDSA curve => proxy curve -> Scalar curve -> Boolcrypton Crypto.PubKey.ECDSA Is a scalar in the accepted range for ECDSA
-
crypton Crypto.PubKey.RSA some parameters lead to breaking assumptions.
-
crypton Crypto.PubKey.RSA.Types some parameters lead to breaking assumptions.
-
crypton Crypto.PubKey.Rabin.Types some parameters lead to breaking assumptions
-
Testing utilities for the validity library Note: There are companion instance packages for this library:
-
GenValid exists to make tests involving Validity types easier and speed up the generation of data for them. To implement tests for this datatype, we would have to be able to generate both primes. We could do this with a generator like this one:
(Prime <$> 'arbitrary') `suchThat` isValid
However, this is tedious and inefficient, as well as quite naive (because arbitrary tends to use very naive generators). The GenValid type class allows you to specify how to (efficiently) generate valid data of the given type to allow for easier and quicker testing. The default implementation of GenValid already gives you a generator and shrinking function for free:instance GenValid Prime
For example, to generate primes, we don't have to consider even numbers other than 2. A more efficient implementation could then look as follows:instance GenValid Prime where genValid = Prime <$> (oneof [ pure 2 , ((\y -> 2 * abs y + 1) <$> arbitrary) `suchThat` isPrime) ])
Typical examples of tests involving validity could look as follows:it "succeeds when given valid input" $ do forAllValid $ \input -> myFunction input `shouldSatisfy` isRight
it "produces valid output when it succeeds" $ do forAllValid $ \input -> case myFunction input of Nothing -> return () -- Can happen Just output -> output `shouldSatisfy` isValid
Definitely also look at the companion packages for more info on how to use this package. class
GGenValid (f :: Type -> Type)genvalidity Data.GenValidity No documentation available.
class
GValidRecursivelyShrink (f :: Type -> Type)genvalidity Data.GenValidity No documentation available.
class
GValidSubterms (f :: Type -> Type) agenvalidity Data.GenValidity No documentation available.