https://github.com/deemru/curve25519
Curve25519 sign/verify for PHP
https://github.com/deemru/curve25519
curve25519 php sign signature verify wavesplatform
Last synced: 3 months ago
JSON representation
Curve25519 sign/verify for PHP
- Host: GitHub
- URL: https://github.com/deemru/curve25519
- Owner: deemru
- License: mit
- Created: 2018-08-27T11:05:25.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2023-04-10T15:52:56.000Z (about 2 years ago)
- Last Synced: 2025-03-17T18:16:26.561Z (3 months ago)
- Topics: curve25519, php, sign, signature, verify, wavesplatform
- Language: PHP
- Homepage: https://packagist.org/packages/deemru/curve25519
- Size: 28.3 KB
- Stars: 11
- Watchers: 2
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Curve25519
[](https://packagist.org/packages/deemru/curve25519) [](https://packagist.org/packages/deemru/curve25519) [](https://github.com/deemru/Curve25519/actions/workflows/php.yml) [](https://app.codacy.com/gh/deemru/Curve25519/files) [](https://packagist.org/packages/deemru/curve25519)
[Curve25519](https://github.com/deemru/Curve25519) implements the missing functionality of sign/verify on [elliptic curve 25519](https://en.wikipedia.org/wiki/Curve25519).
- Cryptographically compatible sign/verify
- Built in cache for last key calculations
- Sodium variant of the sign function (~2000x faster)## Usage
```php
$curve25519 = new Curve25519();
$msg = 'Hello, world!';$privateKey = random_bytes( 32 );
$sig = $curve25519->sign( $msg, $privateKey );$publicKey = $curve25519->getPublicKeyFromPrivateKey( $privateKey );
$verify = $curve25519->verify( $sig, $msg, $publicKey );if( !$verify )
exit( 1 );
```## Requirements
- [PHP](http://php.net) >= 5.6
## Recommended
- [PHP](http://php.net) >= 7.2
- [Sodium](http://php.net/manual/en/book.sodium.php)## Installation
Require through Composer:
```json
{
"require": {
"deemru/curve25519": "1.0.*"
}
}
```## Notice
- `sign_sodium` hashes private key internally by SHA-512
- Beware of `rseed` functionality (for experts only)
- Consider to use [ED25519_NO_SHA512SK sodium build](https://gist.github.com/deemru/145c3eb323bb3fb0f1cc4a72f5567640)