PHP bindings for the GOLANG implementation of the sr25519 cryptography library
Reference to https://github.com/ChainSafe/go-schnorrkel
composer require gmajor/sr25519-bindings
- PHP 7 >= 7.4.0, PHP 8 FFI support
- GOLANG (>1.15)
cd go && go build -buildmode=c-shared -o sr25519.so . && mv sr25519.so ../src/Crypto/sr25519.so
Codec supports PSR-4
autoloaders.
<?php
# When installed via composer
require_once 'vendor/autoload.php';
Init a sr25519 KeyPair
<?php
use Crypto\sr25519;
$sr = new sr25519();
$secretSeed = "...";
$pair = $sr->InitKeyPair("{$secretSeed}");
You can sign a message by passing the message
<?php
use Crypto\sr25519;
$sr = new sr25519();
$sr->Sign($sr->InitKeyPair("secretSeed"), "msg");
Verify a signature proof
<?php
use Crypto\sr25519;
$sr = new sr25519();
$sr->VerifySign($sr->InitKeyPair("secretSeed"), "helloworld", "signature");
implementation of https://github.com/pierrec/xxHash/xxHash64
<?php
use Crypto\sr25519;
$sr = new sr25519();
$sr->XXHash64CheckSum(0, "helloworld");
make test
The package is available as open source under the terms of the MIT License