How to use the bs58.encode function in bs58

To help you get started, we’ve selected a few bs58 examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github orbs-network / orbs-network-typescript / projects / common-library-typescript / src / CryptoUtils.ts View on Github external
public verifySignature(signer: string, data: Buffer | string, signature: string): boolean {
    // TODO remove dummy keys
    const publicKey: PublicKey = this.nodePublicKeys.get(signer) || this.nodePublicKeys.get("dummy");
    logger.debug(`Got public key ${base58.encode(publicKey)} for ${signer}`);
    if (!publicKey) {
      return false;
    }
    const dataBuf: Buffer = (typeof(data) === "string") ? new Buffer(data, "utf8") : data;
    const digest: Buffer = crypto.createHash("SHA256").update(dataBuf).digest();
    return ec.verify(digest, base58.decode(signature), publicKey);
  }
github OriginProtocol / origin / experimental / origin-ipfs / src / index.js View on Github external
function getIpfsHashFromBytes32(bytes32Hex) {
  // Add our default ipfs values for first 2 bytes:
  // function:0x12=sha2, size:0x20=256 bits
  // and cut off leading "0x"
  const hashHex = '1220' + bytes32Hex.slice(2)
  const hashBytes = Buffer.from(hashHex, 'hex')
  const hashStr = bs58.encode(hashBytes)
  return hashStr
}
github realitio / realitio-dapp / assets / js / scripts / main.js View on Github external
function bytes32ToIPFSHash(hash_hex) {
    //console.log('bytes32ToIPFSHash starts with hash_buffer', hash_hex.replace(/^0x/, ''));
    var buf = new Buffer(hash_hex.replace(/^0x/, '1220'), 'hex')
    return bs58.encode(buf)
}
github kingswisdom / SteemMessenger / view / js / crypto / steem-js / auth / ecc / src / key_public.js View on Github external
toPublicKeyString(address_prefix = 'STM') {
        if(this.pubdata) return address_prefix + this.pubdata
        const pub_buf = this.toBuffer();
        const checksum = hash.ripemd160(pub_buf);
        const addy = Buffer.concat([pub_buf, checksum.slice(0, 4)]);
        this.pubdata = base58.encode(addy)
        return address_prefix + this.pubdata;
    }
github steemit / steem-js / src / auth / ecc / src / key_public.js View on Github external
toPublicKeyString(address_prefix = config.get('address_prefix')) {
        if(this.pubdata) return address_prefix + this.pubdata
        const pub_buf = this.toBuffer();
        const checksum = hash.ripemd160(pub_buf);
        const addy = Buffer.concat([pub_buf, checksum.slice(0, 4)]);
        this.pubdata = base58.encode(addy)
        return address_prefix + this.pubdata;
    }
github freedomexio / rocketx-condenser / shared / ecc / src / key_public.js View on Github external
toPublicKeyString(address_prefix = config.address_prefix) {
        if(this.pubdata) return address_prefix + this.pubdata
        const pub_buf = this.toBuffer();
        const checksum = hash.ripemd160(pub_buf);
        const addy = Buffer.concat([pub_buf, checksum.slice(0, 4)]);
        this.pubdata = base58.encode(addy)
        return address_prefix + this.pubdata;
    }
github peerplays-network / peerplays-core-gui / lib / ecc / src / PublicKey.js View on Github external
toAddressString(address_prefix = ChainConfig.address_prefix) {
    let pub_buf = this.toBuffer();
    let pub_sha = sha512(pub_buf);
    let addy = ripemd160(pub_sha);
    let checksum = ripemd160(addy);
    addy = Buffer.concat([addy, checksum.slice(0, 4)]);
    return address_prefix + encode(addy);
  }
github kingswisdom / SteemMessenger / view / js / crypto / steem-js / auth / ecc / src / key_public.js View on Github external
toAddressString(address_prefix = 'STM') {
        var pub_buf = this.toBuffer();
        var pub_sha = hash.sha512(pub_buf);
        var addy = hash.ripemd160(pub_sha);
        var checksum = hash.ripemd160(addy);
        addy = Buffer.concat([addy, checksum.slice(0, 4)]);
        return address_prefix + base58.encode(addy);
    }
github bitpay / bitauth / lib / encrypt.js View on Github external
module.exports = function encrypt(password, str) {
  var aes256 = crypto.createCipher('aes-256-cbc', password);
  var a = aes256.update(str, 'utf8');
  var b = aes256.final();
  var buf = new Buffer(a.length + b.length);

  a.copy(buf, 0);
  b.copy(buf, a.length);

  return base58.encode(buf);
};
github florianheinemann / passwordless / lib / passwordless / passwordless.js View on Github external
return function() {
		var buf = crypto.randomBytes(randomBytes);
		return base58.encode(buf);
	}
};

bs58

Base 58 encoding / decoding

MIT
Latest version published 5 months ago

Package Health Score

74 / 100
Full package analysis

Popular bs58 functions