PHPackages                             mdanter/ecc - 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. [Security](/categories/security)
4. /
5. mdanter/ecc

Abandoned → [paragonie/ecc](/?search=paragonie%2Fecc)Library[Security](/categories/security)

mdanter/ecc
===========

PHP Elliptic Curve Cryptography library

v1.0.0(5y ago)3475.7M—5.8%104[9 issues](https://github.com/phpecc/phpecc/issues)[6 PRs](https://github.com/phpecc/phpecc/pulls)20MITPHPPHP ^7.0||^8.0

Since Jul 7Pushed 2y ago26 watchersCompare

[ Source](https://github.com/phpecc/phpecc)[ Packagist](https://packagist.org/packages/mdanter/ecc)[ Docs](https://github.com/phpecc/phpecc)[ RSS](/packages/mdanter-ecc/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (4)Versions (27)Used By (20)Security (2)

Pure PHP Elliptic Curve DSA and DH
----------------------------------

[](#pure-php-elliptic-curve-dsa-and-dh)

[![Build Status](https://camo.githubusercontent.com/6a2b063922a281dc37680424b23ce62b0a46b8a085fe10c486ab406ec61f137c/68747470733a2f2f7472617669732d63692e6f72672f7068706563632f7068706563632e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/phpecc/phpecc)

[![Scrutinizer Code Quality](https://camo.githubusercontent.com/7941e4d98207d7568e5912a0a9990c3ae253b1e23ab8c2264b64d3fde2aafaab/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f7068706563632f7068706563632f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/phpecc/phpecc?branch=master)[![Code Coverage](https://camo.githubusercontent.com/e5c5f0068c2d8d771191dfa156e7849f7525b42e7ddf8f63aa2b9ce01a5339b2/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f7068706563632f7068706563632f6261646765732f636f7665726167652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/phpecc/phpecc/?branch=master)

[![Latest Stable Version](https://camo.githubusercontent.com/835a6b9022806290819dda9f286818d1bfe4770d317b0bce20c6c67e9ad9fa50/68747470733a2f2f706f7365722e707567782e6f72672f6d64616e7465722f6563632f762f737461626c652e706e67)](https://packagist.org/packages/mdanter/ecc)[![Total Downloads](https://camo.githubusercontent.com/7a6d440f545f1b728e03ee05ed80e50f55707b1f0db6b5e313d00a69934093c0/68747470733a2f2f706f7365722e707567782e6f72672f6d64616e7465722f6563632f646f776e6c6f6164732e706e67)](https://packagist.org/packages/mdanter/ecc)[![Latest Unstable Version](https://camo.githubusercontent.com/d3a98e28f85d926b4bd07460e9fd0c03acec43036d3ab31b776b648e62683b58/68747470733a2f2f706f7365722e707567782e6f72672f6d64616e7465722f6563632f762f756e737461626c652e706e67)](https://packagist.org/packages/mdanter/ecc)[![License](https://camo.githubusercontent.com/38b47d81c8f5b32ccaef6289bb927fa12d1fd02f249355919ff65f41017dc92e/68747470733a2f2f706f7365722e707567782e6f72672f6d64616e7465722f6563632f6c6963656e73652e706e67)](https://packagist.org/packages/mdanter/ecc)

### Information

[](#information)

This library is a rewrite/update of Matyas Danter's ECC library. All credit goes to him.

For more information on Elliptic Curve Cryptography please read [this fine article](http://www.matyasdanter.com/2010/12/elliptic-curve-php-oop-dsa-and-diffie-hellman/).

The library supports the following curves:

- secp112r1
- secp256k1
- nistp192
- nistp224
- nistp256 / secp256r1
- nistp384 / secp384r1
- nistp521

During ECDSA, a random value `k` is required. It is acceptable to use a true RNG to generate this value, but should the same `k` value ever be repeatedly used for a key, an attacker can recover that signing key. The HMAC random generator can derive a deterministic k value from the message hash and private key, voiding this concern.

The library uses a non-branching Montgomery ladder for scalar multiplication, as it's constant time and avoids secret dependant branches.

### License

[](#license)

This package is released under the MIT license.

### Requirements

[](#requirements)

- PHP 7.0+ or PHP 8.0+
- composer
- ext-gmp

Support for older PHP versions:

- v0.4.x: php ^5.6|&lt;7.2
- v0.5.x: php ^7.0
- v1.0.x: php ^7.0|^8.0

### Installation

[](#installation)

You can install this library via Composer :

`composer require mdanter/ecc:^1.0`

### Contribute

[](#contribute)

When sending in pull requests, please make sure to run the `make` command.

The default target runs all PHPUnit and PHPCS tests. All tests must validate for your contribution to be accepted.

It's also always a good idea to check the results of the [Scrutinizer analysis](https://scrutinizer-ci.com/g/phpecc/phpecc/) for your pull requests.

### Usage

[](#usage)

Examples:

- [Key generation](./examples/key_generation.php)
- [ECDH exchange](./examples/ecdh_exchange.php)
- [Signature creation](./examples/creating_signature.php)
- [Signature verification](./examples/verify_signature.php)

###  Health Score

54

—

FairBetter than 97% of packages

Maintenance19

Infrequent updates — may be unmaintained

Popularity64

Solid adoption and visibility

Community47

Growing community involvement

Maturity78

Established project with proven stability

 Bus Factor1

Top contributor holds 63% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~125 days

Recently: every ~194 days

Total

20

Last Release

1948d ago

Major Versions

v0.4.7 → 7.3.x-dev2019-03-05

PHP version history (7 changes)v0.3.1PHP &gt;=5.4.0

0.2.0PHP &gt;=5.3.3

v0.4.0PHP &gt;=5.6.0

v0.4.4PHP &gt;=5.6.0, &lt;7.2

v0.5.0PHP &gt;=7.0

v0.5.1PHP ^7.0

v1.0.0PHP ^7.0||^8.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/763cdc5cc50414bacd4ff1080eede79432f7c3cc26a3d8aa9031b1537a8bd734?d=identicon)[thomaskerin](/maintainers/thomaskerin)

![](https://www.gravatar.com/avatar/6bf97b6041a621ae7330b1bb13262ca91d42f467397b8f44c13eab7b3bd41271?d=identicon)[mdanter](/maintainers/mdanter)

---

Top Contributors

[![afk11](https://avatars.githubusercontent.com/u/5617245?v=4)](https://github.com/afk11 "afk11 (174 commits)")[![btcdrak](https://avatars.githubusercontent.com/u/7275704?v=4)](https://github.com/btcdrak "btcdrak (47 commits)")[![rubensayshi](https://avatars.githubusercontent.com/u/649160?v=4)](https://github.com/rubensayshi "rubensayshi (14 commits)")[![mdanter](https://avatars.githubusercontent.com/u/2213324?v=4)](https://github.com/mdanter "mdanter (8 commits)")[![fgrosse](https://avatars.githubusercontent.com/u/733004?v=4)](https://github.com/fgrosse "fgrosse (6 commits)")[![kornrunner](https://avatars.githubusercontent.com/u/725986?v=4)](https://github.com/kornrunner "kornrunner (6 commits)")[![Spomky](https://avatars.githubusercontent.com/u/1091072?v=4)](https://github.com/Spomky "Spomky (4 commits)")[![scintill](https://avatars.githubusercontent.com/u/848492?v=4)](https://github.com/scintill "scintill (2 commits)")[![xsilen-tt](https://avatars.githubusercontent.com/u/90232688?v=4)](https://github.com/xsilen-tt "xsilen-tt (2 commits)")[![johanderuijter](https://avatars.githubusercontent.com/u/1373219?v=4)](https://github.com/johanderuijter "johanderuijter (2 commits)")[![aztech-dev](https://avatars.githubusercontent.com/u/93562568?v=4)](https://github.com/aztech-dev "aztech-dev (2 commits)")[![scrutinizer-auto-fixer](https://avatars.githubusercontent.com/u/6253494?v=4)](https://github.com/scrutinizer-auto-fixer "scrutinizer-auto-fixer (1 commits)")[![staabm](https://avatars.githubusercontent.com/u/120441?v=4)](https://github.com/staabm "staabm (1 commits)")[![paragonie-security](https://avatars.githubusercontent.com/u/15914520?v=4)](https://github.com/paragonie-security "paragonie-security (1 commits)")[![makuser](https://avatars.githubusercontent.com/u/1778889?v=4)](https://github.com/makuser "makuser (1 commits)")[![mdance](https://avatars.githubusercontent.com/u/121057?v=4)](https://github.com/mdance "mdance (1 commits)")[![carusogabriel](https://avatars.githubusercontent.com/u/16328050?v=4)](https://github.com/carusogabriel "carusogabriel (1 commits)")[![paragonie-scott](https://avatars.githubusercontent.com/u/11591518?v=4)](https://github.com/paragonie-scott "paragonie-scott (1 commits)")[![dktapps](https://avatars.githubusercontent.com/u/14214667?v=4)](https://github.com/dktapps "dktapps (1 commits)")[![rgex](https://avatars.githubusercontent.com/u/3996942?v=4)](https://github.com/rgex "rgex (1 commits)")

---

Tags

ecdhECDSAellipticcurvesecp256k1nistp192nistp224nistp256nistp521nistp384DiffieHellmanphpeccsecp256r1

###  Code Quality

TestsPHPUnit

Code StylePHP\_CodeSniffer

### Embed Badge

![Health badge](/badges/mdanter-ecc/health.svg)

```
[![Health](https://phpackages.com/badges/mdanter-ecc/health.svg)](https://phpackages.com/packages/mdanter-ecc)
```

###  Alternatives

[paragonie/ecc

PHP Elliptic Curve Cryptography library

24682.1k29](/packages/paragonie-ecc)[simplito/elliptic-php

Fast elliptic curve cryptography

2312.2M254](/packages/simplito-elliptic-php)[ionux/phactor

Phactor is a high-performance PHP implementation of the elliptic curve math functions required to generate &amp; verify private/public (asymmetric) EC keypairs and ECDSA signatures based on secp256k1 curve parameters. This library also includes a class to generate Service Identification Numbers (SINs) based on the published Identity Protocol v1 spec.

5275.0k30](/packages/ionux-phactor)[bitwasp/secp256k1-php

PHP Extension with bindings for bitcoin/secp256k1.

58185.7k35](/packages/bitwasp-secp256k1-php)[kornrunner/secp256k1

Pure PHP secp256k1

37566.4k109](/packages/kornrunner-secp256k1)[acmephp/ssl

PHP wrapper around OpenSSL extension providing SSL encoding, decoding, parsing and signing features

141.2M4](/packages/acmephp-ssl)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
