PHP ECC Class Library

This is a very simple frontend to Matyas Danter's phpecc libraries for the EC algorithm. Still under active development. Currently it generates an EC keypair, and can generate a public key from a given private key.


  • PHP 5.3 or later
  • GMP or BCMATH Extension

How to Use

The library is very simple at the moment and offers just private and public key generation. Future revisions will include message signing and verification.

Generate a new keypair:

//Use base 256
define('MAX_BASE', 256);

include '';
include 'classes/PHPECC.class.php';
include 'classes/SECurve.class.php';

$keypair = PHPECC::hex_keypair_genorate();


Generate a new private key only:

echo $pKey = PHPECC::hex_private_key_genorate();

Get the public key from the private key

echo $pubKey = PHPECC::hex_private_key_to_hex_public_key($pKey);


The latest version can be obtained from GitHub:

If you find this useful:
BTC: 1B6eyXVRPxdEitW5vWrUnzzXUy6o38P9wN