Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function newAddrFromPub(pubKey) {
var pre = blake.blake2b(pubKey, null, ADDR_SIZE);
return pre.slice(0, ADDR_SIZE);
}
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');
}
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');
}