Cryptographic javascript-functions for ethereum and tutorials to use them with web3js and solidity
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
eth-crypto/dist/lib/public-key-by-private-key.js

19 lines
612 B

"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.publicKeyByPrivateKey = publicKeyByPrivateKey;
var _ethereumjsUtil = require("ethereumjs-util");
var _util = require("./util");
/**
* Generate publicKey from the privateKey.
* This creates the uncompressed publicKey,
* where 04 has stripped from left
* @returns {string}
*/
function publicKeyByPrivateKey(privateKey) {
privateKey = (0, _util.addLeading0x)(privateKey);
var publicKeyBuffer = (0, _ethereumjsUtil.privateToPublic)((0, _ethereumjsUtil.toBuffer)(privateKey));
return publicKeyBuffer.toString('hex');
}