PHPackages                             leigh/curve25519 - 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. leigh/curve25519

AbandonedArchivedLibrary[Security](/categories/security)

leigh/curve25519
================

Pure PHP implementation of the Curve25519 Diffie-Hellman function

0.1.0(10y ago)2126.0k—0%2[1 issues](https://github.com/lt/PHP-Curve25519/issues)1MITPHPPHP &gt;=5.4

Since Dec 21Pushed 10y ago1 watchersCompare

[ Source](https://github.com/lt/PHP-Curve25519)[ Packagist](https://packagist.org/packages/leigh/curve25519)[ Docs](https://github.com/lt/PHP-Curve25519)[ RSS](/packages/leigh-curve25519/feed)WikiDiscussions master Synced 3w ago

READMEChangelogDependencies (1)Versions (2)Used By (1)

Curve25519 in PHP
=================

[](#curve25519-in-php)

This is a pure PHP implementation of the Curve25519 Diffie-Hellman function.

The library has been written to be high performance (relative to PHP), not pretty. It obviously doesn't perform anywhere close to a native implementation.

### Usage:

[](#usage)

```
$mySecret = random_bytes(32);
$myPublic = \Curve25519\publicKey($mySecret);
$shared   = \Curve25519\sharedKey($mySecret, $theirPublic);

```

### Multi-party shared secrets:

[](#multi-party-shared-secrets)

When more than two parties are communicating, it is necessary to communicate intermediate values so that each party can compute a common shared secret

```
$alicePrivate = str_repeat('a', 32);
$bobPrivate   = str_repeat('b', 32);
$carolPrivate = str_repeat('c', 32);

$alicePublic = \Curve25519\publicKey($alicePrivate); // Send to Bob
$bobPublic   = \Curve25519\publicKey($bobPrivate);   // Send to Carol
$carolPublic = \Curve25519\publicKey($carolPrivate); // Send to Alice

$aliceCarolShared = \Curve25519\sharedKey($alicePrivate, $carolPublic); // Send to Bob
$bobAliceShared   = \Curve25519\sharedKey($bobPrivate,   $alicePublic); // Send to Carol
$carolBobShared   = \Curve25519\sharedKey($carolPrivate, $bobPublic);   // Send to Alice

$aliceShared = \Curve25519\sharedKey($alicePrivate, $carolBobShared);
$bobShared   = \Curve25519\sharedKey($bobPrivate,   $aliceCarolShared);
$carolShared = \Curve25519\sharedKey($carolPrivate, $bobAliceShared);

// An adversary potentially observed f(a), f(b), f(c), f(ab), f(ac), and f(bc),
// whereas each party solved for f(abc)
var_dump($aliceShared === $bobShared && $bobShared === $carolShared);

```

###  Health Score

31

—

LowBetter than 66% of packages

Maintenance19

Infrequent updates — may be unmaintained

Popularity34

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity48

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

Unknown

Total

1

Last Release

3837d ago

### Community

Maintainers

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

---

Top Contributors

[![lt](https://avatars.githubusercontent.com/u/1503065?v=4)](https://github.com/lt "lt (13 commits)")

---

Tags

securityecdhelliptic

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/leigh-curve25519/health.svg)

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

###  Alternatives

[phpseclib/phpseclib

PHP Secure Communications Library - Pure-PHP implementations of RSA, AES, SSH2, SFTP, X.509 etc.

5.6k455.2M1.5k](/packages/phpseclib-phpseclib)[defuse/php-encryption

Secure PHP Encryption Library

3.9k170.7M239](/packages/defuse-php-encryption)[mews/purifier

Laravel 5/6/7/8/9/10 HtmlPurifier Package

2.0k18.0M134](/packages/mews-purifier)[robrichards/xmlseclibs

A PHP library for XML Security

41582.2M138](/packages/robrichards-xmlseclibs)[spatie/laravel-csp

Add CSP headers to the responses of a Laravel app

86110.6M23](/packages/spatie-laravel-csp)[simplito/elliptic-php

Fast elliptic curve cryptography

2302.4M266](/packages/simplito-elliptic-php)

PHPackages © 2026

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