PHPackages                             public-square/phpecc - 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. public-square/phpecc

ActiveLibrary[Security](/categories/security)

public-square/phpecc
====================

PHP Elliptic Curve Cryptography library

v0.1.2(3y ago)02.3k↓83.3%11MITPHPPHP ^8.0

Since Oct 7Pushed 2y agoCompare

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

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

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

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

[![Latest Stable Version](https://camo.githubusercontent.com/687b312bc6a2e999f98ea6209436693c00fbdd58dbea19bd340edb992aee0494/68747470733a2f2f706f7365722e707567782e6f72672f7075626c69632d7371756172652f7068706563632f762f737461626c652e706e67)](https://packagist.org/packages/public-square/phpecc)[![Total Downloads](https://camo.githubusercontent.com/eed537b7c78ce955f75aecbc63618cca545b86aafd0e8baefe4bda2d0c32de78/68747470733a2f2f706f7365722e707567782e6f72672f7075626c69632d7371756172652f7068706563632f646f776e6c6f6164732e706e67)](https://packagist.org/packages/public-square/phpecc)[![Latest Unstable Version](https://camo.githubusercontent.com/9fe39d68beab73a66c55676163c25245c3af2437295af4988514b847282fc2e2/68747470733a2f2f706f7365722e707567782e6f72672f7075626c69632d7371756172652f7068706563632f762f756e737461626c652e706e67)](https://packagist.org/packages/public-square/phpecc)[![License](https://camo.githubusercontent.com/b989d5490a411ed0fb803d2dda009e7f1806eca654820c8589420fd56abe34f1/68747470733a2f2f706f7365722e707567782e6f72672f7075626c69632d7371756172652f7068706563632f6c6963656e73652e706e67)](https://packagist.org/packages/public-square/phpecc)

### Information

[](#information)

This library is a fork of Matyas Danter's ECC library. All credit goes to him and previous contributors. This fork is a drop in replacement that contains support for Schnorr signing and verifying.

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

### Installation

[](#installation)

You can install this library via Composer :

`composer require public-square/phpecc`

### Contribute

[](#contribute)

Please open a pull request.

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

28

—

LowBetter than 54% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity20

Limited adoption so far

Community21

Small or concentrated contributor base

Maturity45

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 61.1% 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 ~2 days

Total

3

Last Release

1313d ago

PHP version history (2 changes)v0.1.0PHP ^7.0||^8.0

v0.1.1PHP ^8.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/f5e2817b784d96765432101f19007abf72dc9540c5fbf54bd780df1a7398ee58?d=identicon)[vpsqr](/maintainers/vpsqr)

---

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)")[![agccurtis](https://avatars.githubusercontent.com/u/5039714?v=4)](https://github.com/agccurtis "agccurtis (9 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)")[![xsilen-tt](https://avatars.githubusercontent.com/u/90232688?v=4)](https://github.com/xsilen-tt "xsilen-tt (2 commits)")[![aztech-dev](https://avatars.githubusercontent.com/u/93562568?v=4)](https://github.com/aztech-dev "aztech-dev (2 commits)")[![johanderuijter](https://avatars.githubusercontent.com/u/1373219?v=4)](https://github.com/johanderuijter "johanderuijter (2 commits)")[![scintill](https://avatars.githubusercontent.com/u/848492?v=4)](https://github.com/scintill "scintill (2 commits)")[![paragonie-scott](https://avatars.githubusercontent.com/u/11591518?v=4)](https://github.com/paragonie-scott "paragonie-scott (1 commits)")[![paragonie-security](https://avatars.githubusercontent.com/u/15914520?v=4)](https://github.com/paragonie-security "paragonie-security (1 commits)")[![rgex](https://avatars.githubusercontent.com/u/3996942?v=4)](https://github.com/rgex "rgex (1 commits)")[![makuser](https://avatars.githubusercontent.com/u/1778889?v=4)](https://github.com/makuser "makuser (1 commits)")[![carusogabriel](https://avatars.githubusercontent.com/u/16328050?v=4)](https://github.com/carusogabriel "carusogabriel (1 commits)")[![scrutinizer-auto-fixer](https://avatars.githubusercontent.com/u/6253494?v=4)](https://github.com/scrutinizer-auto-fixer "scrutinizer-auto-fixer (1 commits)")[![dktapps](https://avatars.githubusercontent.com/u/14214667?v=4)](https://github.com/dktapps "dktapps (1 commits)")[![staabm](https://avatars.githubusercontent.com/u/120441?v=4)](https://github.com/staabm "staabm (1 commits)")

---

Tags

ecdhschnorrECDSAellipticcurvesecp256k1nistp192nistp224nistp256nistp521nistp384DiffieHellmanphpeccsecp256r1

###  Code Quality

TestsPHPUnit

Code StylePHP\_CodeSniffer

### Embed Badge

![Health badge](/badges/public-square-phpecc/health.svg)

```
[![Health](https://phpackages.com/badges/public-square-phpecc/health.svg)](https://phpackages.com/packages/public-square-phpecc)
```

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