deemru / curve25519
Curve25519 sign/verify
Installs: 26 992
Dependents: 3
Suggesters: 0
Security: 0
Stars: 11
Watchers: 3
Forks: 2
Open Issues: 0
Requires
- php: >=5.6
Requires (Dev)
- deemru/abcode: 1.0.*
Suggests
- ext-sodium: Up to ~2000x faster sign/verify
README
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
- PHP >= 5.6
Recommended
Installation
Require through Composer:
{ "require": { "deemru/curve25519": "1.0.*" } }
Notice
sign_sodium
hashes private key internally by SHA-512- Beware of
rseed
functionality (for experts only) - Consider to use ED25519_NO_SHA512SK sodium build