PHPackages                             ricco381/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. ricco381/ecc

ActiveLibrary

ricco381/ecc
============

PHP Elliptic Curve Cryptography library

0.4(7y ago)0271MITPHPPHP ^7.0

Since Apr 19Pushed 7y ago1 watchersCompare

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

READMEChangelog (4)Dependencies (4)Versions (5)Used By (1)

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+
- composer
- ext-gmp

For PHP5.6 compatibility, use the v0.4.x releases.

### Installation

[](#installation)

You can install this library via Composer :

`composer require mdanter/ecc`

### 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

23

—

LowBetter than 27% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity7

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity47

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% 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 ~0 days

Total

4

Last Release

2582d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/90cbdcd8dacd40c8a1f1f344051d5c6b1fd35cc9696f8de9f8a99e687ea3ec52?d=identicon)[ricco381](/maintainers/ricco381)

---

Top Contributors

[![ricco381](https://avatars.githubusercontent.com/u/11959563?v=4)](https://github.com/ricco381 "ricco381 (5 commits)")

---

Tags

ecdhECDSAellipticcurvesecp256k1nistp192nistp224nistp256nistp521nistp384DiffieHellmanphpeccsecp256r1

###  Code Quality

TestsPHPUnit

Code StylePHP\_CodeSniffer

### Embed Badge

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

```
[![Health](https://phpackages.com/badges/ricco381-ecc/health.svg)](https://phpackages.com/packages/ricco381-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)[paragonie/sodium_compat

Pure PHP implementation of libsodium; uses the PHP extension if it exists

934131.6M155](/packages/paragonie-sodium-compat)[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)[kornrunner/secp256k1

Pure PHP secp256k1

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

Let's Encrypt client written in PHP

649155.1k](/packages/acmephp-acmephp)

PHPackages © 2026

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