Пример #1
0
 private function diffieHellman($publicKeyPoints, $privateKey)
 {
     $ecdsa = new BitcoinECDSA();
     $normalizedPublicKey = ['x' => '0x' . $publicKeyPoints['x'], 'y' => '0x' . $publicKeyPoints['y']];
     $product = $ecdsa->mulPoint($privateKey, $normalizedPublicKey);
     $secretPoints = ['x' => gmp_strval($product['x'], 16), 'y' => gmp_strval($product['y'], 16)];
     return $secretPoints;
 }
Пример #2
0
<?php

set_time_limit(0);
use BitcoinPHP\BitcoinECDSA\BitcoinECDSA;
require_once "src/BitcoinPHP/BitcoinECDSA/BitcoinECDSA.php";
$bitcoinECDSA = new BitcoinECDSA();
$time = microtime(true);
for ($i = 0; $i < 1000; $i++) {
    $bitcoinECDSA->generateRandomPrivateKey();
    $bitcoinECDSA->getAddress();
}
echo "generated 1000 Addresses in " . (microtime(true) - $time) . " seconds";