Last active
June 19, 2018 11:18
-
-
Save evias/b30c6b8821b9c309d921188a21d44f64 to your computer and use it in GitHub Desktop.
PHP KeyPair Creation - Case Reproduction
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"require": { | |
"php": ">=5.5.9", | |
"evias/nem-php": "dev-master", | |
"kornrunner/keccak": "@dev" | |
}, | |
"require-dev": { | |
}, | |
"autoload": { | |
"classmap": [ | |
], | |
"files": [ | |
], | |
"psr-4": { | |
} | |
}, | |
"autoload-dev": { | |
"classmap": [ | |
], | |
"psr-4": { | |
} | |
}, | |
"config": { | |
"preferred-install": "dist" | |
}, | |
"extra": { | |
"component": "application" | |
}, | |
"minimum-stability": "stable" | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
require __DIR__ . '/vendor/autoload.php'; | |
$priv = "1925f8049d117284ad3fb7ed8029453654613010ac887d1527fe582459da78db"; | |
$kp = new \NEM\Core\KeyPair($priv); | |
echo "Input: ", $priv, PHP_EOL; | |
echo "Public Key: ", $kp->getPublicKey()->getHex(), PHP_EOL; | |
echo "Private Key: ", $kp->getPrivateKey()->getHex(), PHP_EOL; | |
echo "Testnet Address: ", $kp->getAddress(-104), PHP_EOL; | |
echo "Mainnet Address: ", $kp->getAddress(104), PHP_EOL; | |
echo PHP_EOL; | |
/** | |
OUTPUT SHOULD BE : | |
Input: 1925f8049d117284ad3fb7ed8029453654613010ac887d1527fe582459da78db | |
Public Key: 85cbd0a7e0f8cd93f23d707ffd6cc9367e2b6256514aa6dcd83725d7857f6f5d | |
Private Key: 1925f8049d117284ad3fb7ed8029453654613010ac887d1527fe582459da78db | |
Testnet Address: TDDWELLRR4GEX3H4DN5FBEPB7WZJH5K7N5BZ6DAJ | |
Mainnet Address: NDDWELLRR4GEX3H4DN5FBEPB7WZJH5K7N64OYTLM | |
**/ | |
exit; | |
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
composer install | |
composer dump-autoload | |
php keyPairReproduce.php |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment