PHP code example of activeledger / ecc
1. Go to this page and download the library: Download activeledger/ecc library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
activeledger / ecc example snippets
use Activeledger\ActiveECC;
class MyCoolClass
{
public function generateKeyPair(): array
{
$ecc = new ActiveECC();
$keyPair = $ecc->generate();
// Alternatively call generate as a static method
$keyPair = ActiveECC::generate();
return $keyPair;
}
}
use Activeledger\ActiveECC;
class MyCoolClass
{
public function signString(string $privateKey, string $data)
{
$ecc = new ActiveECC();
$signature = $ecc->sign($privateKey, $string);
return $signature;
}
}