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

ActiveLibrary

alex2k19/ecc
============

PHP Elliptic Curve Cryptography library

08PHPCI failing

Since Jul 25Pushed 5y agoCompare

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

READMEChangelogDependenciesVersions (1)Used By (0)

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)[![HHVM Status](https://camo.githubusercontent.com/f3895bfedf06b3724e57ef8eea30a73cc06d802059206dc84788b4746c33ea9d/687474703a2f2f6868766d2e683463632e64652f62616467652f6d64616e7465722f6563632e737667)](http://hhvm.h4cc.de/package/mdanter/ecc)

[![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 / secg256r1
- nistp384 / secg384r1
- nistp521

The library exposes a class for random byte generation, for PHP7+ users is provided by `random_bytes`. PHP5.6 users will use the paragonie/random\_bytes polyfill.

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.

### Compatibility notice:

[](#compatibility-notice)

A dependency used by this library in v0.4.x interacts with a newly reserved keyword in PHP 7.2. Therefore the library cannot be used on 7.2. For a PHP7.0+ branch, you should upgrade to [v0.5.x](https://github.com/phpecc/phpecc/releases/tag/v0.5.0)

### License

[](#license)

This package is released under the MIT license.

### Requirements

[](#requirements)

- PHP 5.6+
- composer
- ext-gmp

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

17

—

LowBetter than 6% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity4

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity33

Early-stage or recently created project

 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.

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/43602841?v=4)[Alex2k19](/maintainers/Alex2k19)[@Alex2k19](https://github.com/Alex2k19)

---

Top Contributors

[![sofwar](https://avatars.githubusercontent.com/u/7130905?v=4)](https://github.com/sofwar "sofwar (1 commits)")

### Embed Badge

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

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

PHPackages © 2026

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