add the binding to get the size by bytes
This commit is contained in:
parent
422c5fdb09
commit
11e42a256d
@ -18,6 +18,7 @@ module Crypto.ECC.Simple.Types
|
|||||||
, CurveBinaryParam(..)
|
, CurveBinaryParam(..)
|
||||||
, CurvePrimeParam(..)
|
, CurvePrimeParam(..)
|
||||||
, curveSizeBits
|
, curveSizeBits
|
||||||
|
, curveSizeBytes
|
||||||
, CurveParameters(..)
|
, CurveParameters(..)
|
||||||
-- * specific curves definition
|
-- * specific curves definition
|
||||||
, SEC_p112r1(..)
|
, SEC_p112r1(..)
|
||||||
@ -70,6 +71,10 @@ curveSizeBits proxy =
|
|||||||
CurvePrime (CurvePrimeParam p) -> numBits p
|
CurvePrime (CurvePrimeParam p) -> numBits p
|
||||||
CurveBinary (CurveBinaryParam c) -> numBits c - 1
|
CurveBinary (CurveBinaryParam c) -> numBits c - 1
|
||||||
|
|
||||||
|
-- | get the size of the curve in bytes
|
||||||
|
curveSizeBytes :: Curve curve => proxy curve -> Int
|
||||||
|
curveSizeBytes proxy = (curveSizeBits proxy + 7) `div` 8
|
||||||
|
|
||||||
-- | Define common parameters in a curve definition
|
-- | Define common parameters in a curve definition
|
||||||
-- of the form: y^2 = x^3 + ax + b.
|
-- of the form: y^2 = x^3 + ax + b.
|
||||||
data CurveParameters curve = CurveParameters
|
data CurveParameters curve = CurveParameters
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user