How to use the blakejs/blake2b.blake2bHex 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 / packages / vitejs / es5 / utils / tools.js View on Github external
function getTokenIdFromRaw(rawTokenId) {
    var err = checkParams({ rawTokenId: rawTokenId }, ['rawTokenId'], [{
            name: 'rawTokenId',
            func: function (_t) { return /^[0-9a-fA-F]+$/.test(_t) && _t.length === 20; }
        }]);
    if (err) {
        console.error(new Error(err.message));
        return null;
    }
    var checkSum = blake.blake2bHex(Buffer.from(rawTokenId, 'hex'), null, 2);
    return "tti_" + rawTokenId + checkSum;
}
exports.getTokenIdFromRaw = getTokenIdFromRaw;
github vitelabs / vite.js / packages / vitejs / es5 / utils / index.js View on Github external
function getTokenIdFromRaw(rawTokenId) {
    var err = checkParams({ rawTokenId: rawTokenId }, ['rawTokenId'], [{
            name: 'rawTokenId',
            func: function (_t) { return /^[0-9a-fA-F]+$/.test(_t) && _t.length === 20; }
        }]);
    if (err) {
        throw new Error(err.message);
    }
    var checkSum = blake.blake2bHex(Buffer.from(rawTokenId, 'hex'), null, 2);
    return "tti_" + rawTokenId + checkSum;
}
exports.getTokenIdFromRaw = getTokenIdFromRaw;
github vitelabs / vite.js / src / utils / index.ts View on Github external
function getTokenIdCheckSum(originalTokenId: Hex): Hex {
    return blake.blake2bHex(Buffer.from(originalTokenId, 'hex'), null, 2);
}
github vitelabs / vite.js / src / accountBlock / accountBlock.ts View on Github external
async getNonce(): Promise {
        const err = checkParams({
            difficulty: this.difficulty,
            previousHash: this.previousHash
        }, [ 'difficulty', 'previousHash' ]);
        if (err) {
            throw err;
        }

        const getNonceHashBuffer = Buffer.from(this.originalAddress + this.previousHash, 'hex');
        const getNonceHash = blake.blake2bHex(getNonceHashBuffer, null, 32);

        const nonce: Base64 = this.provider.request('util_getPoWNonce', this.difficulty, getNonceHash);
        return nonce;
    }
github vitelabs / vite.js / src / accountBlock / utils.ts View on Github external
export function getDataHex(data: Base64): Hex {
    return data ? blake.blake2bHex(Buffer.from(data, 'base64'), null, 32) : '';
}
github vitelabs / vite.js / ViteJS / es5 / src / address.js View on Github external
function getAddrCheckSum(addr) {
  var res = blake.blake2bHex(addr, null, ADDR_CHECK_SUM_SIZE);
  return res;
}

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