gmajor/sr25519-bindings

sr25519 bindings

Maintainers

👁 gmajor-encrypt

Package info

github.com/gmajor-encrypt/sr25519-bindings

Language:Go

pkg:composer/gmajor/sr25519-bindings

Statistics

Installs: 17 679

Dependents: 4

Suggesters: 0

Stars: 2

Open Issues: 0

v1.0.0 2023-02-23 00:27 UTC

Requires

  • php: >=8.0
  • ext-ffi: *

Requires (Dev)

Suggests

None

Provides

None

Conflicts

None

Replaces

None

MIT b32e44fdfec1b33208058bef6c5afad9ca3f36ce

hashsr25519

This package is auto-updated.

Last update: 2026-06-15 13:33:10 UTC


README

PHP bindings for the GOLANG implementation of the sr25519 cryptography library

Reference to https://github.com/ChainSafe/go-schnorrkel

Installation

composer require gmajor/sr25519-bindings

Building

Requirement

  1. PHP 7 >= 7.4.0, PHP 8 FFI support
  2. GOLANG (>1.15)

Build

cd go && go build -buildmode=c-shared -o sr25519.so . && mv sr25519.so ../src/Crypto/sr25519.so

Basic Usage

Autoloading

Codec supports PSR-4 autoloaders.

<?php
# When installed via composer
require_once 'vendor/autoload.php';

KeyPair

Init a sr25519 KeyPair

<?php
use Crypto\sr25519;
$sr = new sr25519();
$secretSeed = "...";
$pair = $sr->InitKeyPair("{$secretSeed}");

sign message

You can sign a message by passing the message

<?php
use Crypto\sr25519;
$sr = new sr25519();
$sr->Sign($sr->InitKeyPair("secretSeed"), "msg");

verify signature

Verify a signature proof

<?php
use Crypto\sr25519;
$sr = new sr25519();
$sr->VerifySign($sr->InitKeyPair("secretSeed"), "helloworld", "signature");

XXHash 64 support

implementation of https://github.com/pierrec/xxHash/xxHash64

<?php
use Crypto\sr25519;
$sr = new sr25519();
$sr->XXHash64CheckSum(0, "helloworld");

Test

make test

Resources

License

The package is available as open source under the terms of the MIT License