How to use the blakejs/blake2b.blake2b function in blakejs

To help you get started, we’ve selected a few blakejs 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 vitelabs / vite.js / ViteJS / es5 / src / address.js View on Github external
function newAddrFromPub(pubKey) {
  var pre = blake.blake2b(pubKey, null, ADDR_SIZE);
  return pre.slice(0, ADDR_SIZE);
}
github vitelabs / vite.js / src / accountBlock / utils.ts View on Github external
if (isRequestBlock(accountBlock.blockType)) {
        source += getAddressHex(accountBlock.toAddress);
        source += getAmountHex(accountBlock.amount);
        source += getTokenIdHex(accountBlock.tokenId);
    } else {
        source += getSendBlockHashHex(accountBlock.sendBlockHash);
    }

    source += getDataHex(accountBlock.data);
    source += getFeeHex(accountBlock.fee);
    source += accountBlock.vmlogHash || '';
    source += getNonceHex(accountBlock.nonce);
    source += getTriggeredSendBlockListHex(accountBlock.triggeredSendBlockList);

    const sourceHex = Buffer.from(source, 'hex');
    const hashBuffer = blake.blake2b(sourceHex, null, 32);
    return Buffer.from(hashBuffer).toString('hex');
}
github vitelabs / vite.js / src / wallet / wallet.ts View on Github external
get id(): Hex {
        let address = '';
        if (this.addressList[0]) {
            address = this.addressList[0].address;
        } else {
            const account = this.deriveAddress(0);
            address = account.address;
        }

        const addressBuffer = Buffer.from(address);
        const idBuffer = blake.blake2b(addressBuffer, null, 32);
        return Buffer.from(idBuffer).toString('hex');
    }

blakejs

Pure Javascript implementation of the BLAKE2b and BLAKE2s hash functions

MIT
Latest version published 3 years ago

Package Health Score

65 / 100
Full package analysis