elliptic-curve alternatives and similar packages
Based on the "Cryptography" category.
Alternatively, view elliptic-curve alternatives based on common mentions on social networks and blogs.
9.7 3.1 elliptic-curve VS cryptonitelowlevel set of cryptographic primitives for haskell
Arithmetic circuits for zero knowledge proof systems
8.5 0.3 elliptic-curve VS galois-fieldFinite field and algebraic extension field arithmetic
Oblivious transfer for multiparty computation
Fast, pure and practical SHA-256 implementation
7.4 0.0 elliptic-curve VS galois-fftFinite field polynomial arithmetic based on fast Fourier transforms
6.6 6.9 elliptic-curve VS signableDeterministic serialisation and signatures with proto-lens and protobuf-elixir support
* Code Quality Rankings and insights are calculated and provided by Lumnify.
They vary from L1 to L5 with "L5" being the highest.
Do you think we are missing an alternative of elliptic-curve or a related project?
An extensible library of elliptic curves used in cryptography research.
An [elliptic curve](src/Data/Curve.hs) E(K) over a field K is a smooth projective plane algebraic cubic curve with a specified base point
O, and the points on E(K) form an algebraic group with identity point
O. By the Riemann-Roch theorem, any elliptic curve is isomorphic to a cubic curve of the form
where is the point at infinity, and are K-rational coefficients that satisfy a non-zero discriminant condition. For cryptographic computational purposes, elliptic curves are represented in several different forms.
A (short) [Weierstrass curve](src/Data/Curve/Weierstrass.hs) is an elliptic curve over for some prime , and is of the form
B are K-rational coefficients such that is non-zero. Weierstrass curves are the most common representations of elliptic curves, as any elliptic curve over a field of characteristic greater than 3 is isomorphic to a Weierstrass curve.
A (short Weierstrass) [binary curve](src/Data/Curve/Binary.hs) is an elliptic curve over for some positive , and is of the form
B are K-rational coefficients such that
B is non-zero. Binary curves have field elements represented by binary integers for efficient arithmetic, and are special cases of long Weierstrass curves over a field of characteristic 2.
A [Montgomery curve](src/Data/Curve/Montgomery.hs) is an elliptic curve over for some prime , and is of the form
B are K-rational coefficients such that is non-zero. Montgomery curves only use the first affine coordinate for computations, and can utilise the Montgomery ladder for efficient multiplication.
A (twisted) [Edwards curve](src/Data/Curve/Edwards.hs) is an elliptic curve over for some prime , and is of the form
D are K-rational coefficients such that is non-zero. Edwards curves have no point at infinity, and their addition and doubling formulae converge.
This library is open for new curve representations and curve implementations through pull requests. These should ideally be executed by replicating and modifying existing curve files, for ease, quickcheck testing, and formatting consistency, but a short description of the file organisation is provided here for clarity. Note that it also has a dependency on the Galois field library and its required language extensions.
The library exposes four promoted data kinds which are used to define a type-safe interface for working with curves.
These are then specialised down into type classes for the different forms.
And then by coordinate system.
A curve class is constructed out of four type parameters which are instantiated in the associated data type Point on the Curve typeclass.
class Curve (f :: Form) (c :: Coordinates) e q r | | | Curve Type o-+ | | Field of Points o---+ | Field of Coefficients o-----+ data Point f c e q r :: *
```haskell ignore data Anomalous
type Fq = Prime Q type Q = 0xb0000000000000000000000953000000000000000000001f9d7
type Fr = Prime R type R = 0xb0000000000000000000000953000000000000000000001f9d7
instance Curve 'Weierstrass c Anomalous Fq Fr => WCurve c Anomalous Fq Fr where -- data instance Point 'Weierstrass c Anomalous Fq Fr
**Arithmetic** ```haskell ignore -- Point addition add :: Point f c e q r -> Point f c e q r -> Point f c e q r -- Point doubling dbl :: Point f c e q r -> Point f c e q r -- Point multiplication by field element mul :: Curve f c e q r => Point f c e q r -> r -> Point f c e q r -- Point multiplication by Integral mul' :: (Curve f c e q r, Integral n) => Point f c e q r -> n -> Point f c e q r -- Point identity id :: Point f c e q r -- Point inversion inv :: Point f c e q r -> Point f c e q r -- Frobenius endomorphism frob :: Point f c e q r -> Point f c e q r -- Random point rnd :: MonadRandom m => m (Point f c e q r)
```haskell ignore -- Curve characteristic char :: Point f c e q r -> Natural
-- Curve cofactor cof :: Point f c e q r -> Natural
-- Check if a point is well-defined def :: Point f c e q r -> Bool
-- Discriminant disc :: Point f c e q r -> q
-- Curve order order :: Point f c e q r -> Natural
-- Curve generator point gen :: Point f c e q r
### Point Arithmetic See [**Example.hs**](examples/Example.hs). ### Elliptic Curve Diffie-Hellman (ECDH) See [**DiffieHellman.hs**](examples/DiffieHellman.hs). ### Representing a new curve using the curve class See [**Weierstrass**](src/Data/Curve/Weierstrass.hs). ### Implementing a new curve using a curve representation See [**Anomalous**](src/Data/Curve/Weierstrass/Anomalous.hs). ### Using an implemented curve Import a curve implementation. ```haskell import qualified Data.Curve.Weierstrass.Anomalous as Anomalous
The data types and constants can then be accessed readily as
We'll test that the Hasse Theorem is successful with an implemented curve as a usage example:
import Protolude import GHC.Natural import qualified Data.Field.Galois as F main :: IO () main = do putText $ "Hasse Theorem succeeds: " <> show (hasseTheorem Anomalous._h Anomalous._r (F.order (witness :: Anomalous.Fq))) where hasseTheorem h r q = join (*) (naturalToInteger (h * r) - naturalToInteger q - 1) <= 4 * naturalToInteger q
The following curves have already been implemented.
- SECT (NIST) curves
- Edwards curves
- [Ed25519 (Curve25519)](src/Data/Curve/Edwards/Ed25519.hs)
- [Ed3363 (HighFive)](src/Data/Curve/Edwards/Ed3363.hs)
- [Ed448 (Goldilocks)](src/Data/Curve/Edwards/Ed448.hs)
- Montgomery curves
- [Curve25519 (Ed25519)](src/Data/Curve/Montgomery/Curve25519.hs)
- [Curve448 (Goldilocks)](src/Data/Curve/Montgomery/Curve448.hs)
- Barreto-Lynn-Scott (BLS) curves
- Barreto-Naehrig (BN) curves
- [BN224 (Fp224BN)](src/Data/Curve/Weierstrass/BN224.hs)
- [BN254 (CurveSNARK)](src/Data/Curve/Weierstrass/BN254.hs)
- [BN254T (CurveSNARKn2)](src/Data/Curve/Weierstrass/BN254T.hs)
- [BN254A (Fp254BNa)](src/Data/Curve/Weierstrass/BN254A.hs)
- [BN254AT (Fp254n2BNa)](src/Data/Curve/Weierstrass/BN254AT.hs)
- [BN254B (Fp254BNb)](src/Data/Curve/Weierstrass/BN254B.hs)
- [BN254BT (Fp254n2BNb)](src/Data/Curve/Weierstrass/BN254BT.hs)
- [BN254C (Fp254BNc)](src/Data/Curve/Weierstrass/BN254C.hs)
- [BN254CT (Fp254n2BNc)](src/Data/Curve/Weierstrass/BN254CT.hs)
- [BN254D (Fp254BNd)](src/Data/Curve/Weierstrass/BN254D.hs)
- [BN254DT (Fp254n2BNd)](src/Data/Curve/Weierstrass/BN254DT.hs)
- [BN256 (Fp256BN)](src/Data/Curve/Weierstrass/BN256.hs)
- [BN384 (Fp384BN)](src/Data/Curve/Weierstrass/BN384.hs)
- [BN462 (Fp462BN)](src/Data/Curve/Weierstrass/BN462.hs)
- [BN462T (Fp462n2BN)](src/Data/Curve/Weierstrass/BN462T.hs)
- [BN512 (Fp512BN)](src/Data/Curve/Weierstrass/BN512.hs)
- Brainpool curves
- SECP (NIST) curves
The data structures in this library are meant for use in research-grade projects and not in interactive protocols. The elliptic curve operations in this library are not constant time and thus may be vulernable to timing attacks if used improperly. If you are unsure of the implications of this, do not use this library.
Copyright (c) 2019-2020 Adjoint Inc. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*Note that all licence references and agreements mentioned in the elliptic-curve README section above are relevant to that project's source code only.