PHPackages                             blockchainethdev/elliptic-php - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. blockchainethdev/elliptic-php

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

blockchainethdev/elliptic-php
=============================

Fast elliptic curve cryptography

1.0.13(2y ago)1679↓100%2MITPHP

Since Apr 26Pushed 2y ago1 watchersCompare

[ Source](https://github.com/blockchainethdev/elliptic-php)[ Packagist](https://packagist.org/packages/blockchainethdev/elliptic-php)[ Docs](https://github.com/blockchainethdev/elliptic-php)[ RSS](/packages/blockchainethdev-elliptic-php/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (1)Dependencies (3)Versions (3)Used By (2)

Fast Elliptic Curve Cryptography in PHP
=======================================

[](#fast-elliptic-curve-cryptography-in-php)

Information
-----------

[](#information)

This library is a PHP port of [elliptic](https://github.com/indutny/elliptic), a great JavaScript ECC library.

- Supported curve types: Short Weierstrass, Montgomery, Edwards, Twisted Edwards.
- Curve 'presets': `secp256k1`, `p192`, `p224`, `p256`, `p384`, `p521`, `curve25519`, `ed25519`.

This software is licensed under the MIT License.

Projects which use Fast ECC PHP library: [PrivMX WebMail](https://privmx.com), ...

Benchmarks
----------

[](#benchmarks)

```
+------------------------+----------------+--------+-----+------+
| subject                | mode           | rstdev | its | revs |
+------------------------+----------------+--------+-----+------+
| elliptic#genKeyPair    | 323.682ops/s   | 2.72%  | 5   | 50   |
| mdanter#genKeyPair     | 13.794ops/s    | 3.18%  | 5   | 50   |
+------------------------+----------------+--------+-----+------+
| elliptic#sign          | 307.228ops/s   | 3.82%  | 5   | 50   |
| mdanter#sign           | 14.118ops/s    | 2.12%  | 5   | 50   |
+------------------------+----------------+--------+-----+------+
| elliptic#verify        | 93.913ops/s    | 5.93%  | 5   | 50   |
| mdanter#verify         | 6.859ops/s     | 2.95%  | 5   | 50   |
+------------------------+----------------+--------+-----+------+
| elliptic#dh            | 135.166ops/s   | 1.67%  | 5   | 50   |
| mdanter#dh             | 14.302ops/s    | 0.89%  | 5   | 50   |
+------------------------+----------------+--------+-----+------+
| elliptic#EdDSASign     | 296.756ops/s   | 1.09%  | 5   | 50   |
+------------------------+----------------+--------+-----+------+
| elliptic#EdDSAVerify   | 67.481ops/s    | 2.76%  | 5   | 50   |
+------------------------+----------------+--------+-----+------+

```

Installation
------------

[](#installation)

You can install this library via Composer:

```
composer require blockchainethdev/elliptic-php

```

Implementation details
----------------------

[](#implementation-details)

ECDSA is using deterministic `k` value generation as per [RFC6979](http://tools.ietf.org/html/rfc6979). Most of the curve operations are performed on non-affine coordinates (either projective or extended), various windowing techniques are used for different cases.

NOTE: `curve25519` could not be used for ECDSA, use `ed25519` instead.

All operations are performed in reduction context using [bn-php](https://github.com/blockchainethdev/bn-php).

API
---

[](#api)

### ECDSA

[](#ecdsa)

```
