https://github.com/kornrunner/php-secp256k1
Pure PHP secp256k1
https://github.com/kornrunner/php-secp256k1
ecc elliptic-curves secp256k1
Last synced: 5 months ago
JSON representation
Pure PHP secp256k1
- Host: GitHub
- URL: https://github.com/kornrunner/php-secp256k1
- Owner: kornrunner
- License: mit
- Created: 2018-06-11T16:04:47.000Z (over 7 years ago)
- Default Branch: main
- Last Pushed: 2024-05-30T14:24:18.000Z (over 1 year ago)
- Last Synced: 2025-05-07T19:07:14.080Z (5 months ago)
- Topics: ecc, elliptic-curves, secp256k1
- Language: PHP
- Homepage:
- Size: 214 KB
- Stars: 33
- Watchers: 3
- Forks: 21
- Open Issues: 5
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# php-secp256k1 [](https://github.com/kornrunner/php-secp256k1/actions/workflows/tests.yml) [](https://coveralls.io/github/kornrunner/php-secp256k1?branch=master) [](https://packagist.org/packages/kornrunner/secp256k1)
```lang=bash
$ composer require kornrunner/secp256k1
```## Usage
Sign a message:
```php
sign($message, $privateKey);// get r
$r = $signature->getR();// get s
$s = $signature->getS();// get recovery param
$v = $signature->getRecoveryParam();// encode to hex
$serializer = new HexSignatureSerializer();
$signatureString = $serializer->serialize($signature);// or you can call toHex
$signatureString = $signature->toHex();
```Verify a message:
```php
verify($hash, $signature, $publicKey);
```## License
MIT
## Crypto
[ 0x9c7b7a00972121fb843af7af74526d7eb585b171][Ethereum]
[Ethereum]: https://etherscan.io/address/0x9c7b7a00972121fb843af7af74526d7eb585b171 "Donate with Ethereum"