web3p/secp256k1
最新稳定版本:v0.2
Composer 安装命令:
composer require web3p/secp256k1
包简介
Ethereum secp256k1 library in PHP.
README 文档
README
secp256k1 for ethereum, this package depends on mdanter/ecc package.
Install
Set minimum stability to dev
composer require web3p/secp256k1
Usage
Sign a message:
use Web3p\Secp256k1\Secp256k1; use Web3p\Secp256k1\Serializer\HexSignatureSerializer; $secp256k1 = new Secp256k1(); // return signature contains r and s. // message and privateKey are hex string $signature = $secp256k1->sign($message, $privateKey); // get r $r = $signature->getR(); // get s $s = $signature->getS(); // encode to hex $serializer = new HexSignatureSerializer(); $signatureString = $serializer->serialize($signature); // or you can call toHex $signatureString = $signature->toHex();
Verify a message:
use Web3p\Secp256k1\Secp256k1; $secp256k1 = new Secp256k1(); // signature was created from sign method. // hash and publicKey are hex string $isVerified = $secp256k1->verify($hash, $signature, $publicKey);
API
Todo.
License
MIT
统计信息
- 总下载量: 341
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 6
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2018-02-16