deemru/curve25519

Curve25519 sign/verify

1.0.9 2023-04-10 15:47 UTC

This package is auto-updated.

Last update: 2024-04-10 18:04:33 UTC


README

packagist php-v GitHub codacy license

Curve25519 implements the missing functionality of sign/verify on elliptic curve 25519.

  • Cryptographically compatible sign/verify
  • Built in cache for last key calculations
  • Sodium variant of the sign function (~2000x faster)

Usage

$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

Recommended

Installation

Require through Composer:

{
    "require": {
        "deemru/curve25519": "1.0.*"
    }
}

Notice