[ECC] add curveSizeBits

This commit is contained in:
Vincent Hanquez 2015-09-22 17:21:35 +01:00
parent 495788dded
commit 9a1f06e3e8

View File

@ -17,6 +17,7 @@ module Crypto.PubKey.ECC.Types
, CurveBinary(..) , CurveBinary(..)
, CurvePrime(..) , CurvePrime(..)
, common_curve , common_curve
, curveSizeBits
, ecc_fx , ecc_fx
, ecc_p , ecc_p
, CurveCommon(..) , CurveCommon(..)
@ -160,6 +161,10 @@ curvesOIDs =
] ]
-} -}
-- | get the size of the curve in bits
curveSizeBits :: Curve -> Int
curveSizeBits = numBits . ecc_n . common_curve
-- | Get the curve definition associated with a recommended known curve name. -- | Get the curve definition associated with a recommended known curve name.
getCurveByName :: CurveName -> Curve getCurveByName :: CurveName -> Curve
getCurveByName SEC_p112r1 = CurveFP $ CurvePrime getCurveByName SEC_p112r1 = CurveFP $ CurvePrime