How to use the blakejs.blake2s 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 Cryptonomic / ConseilJS / src / chain / tezos / contracts / TCFBakerRegistryHelper.ts View on Github external
export async function verifyDestination(server: string, address: string): Promise {
        const contract = await TezosNodeReader.getAccountForBlock(server, 'head', address);

        if (!!!contract.script) { throw new Error(`No code found at ${address}`); }

        const k = Buffer.from(blakejs.blake2s(contract['script'].toString(), null, 16)).toString('hex');

        if (k !== '1527ddf08bdf582dce0b28c051044897') { throw new Error(`Contract at ${address} does not match the expected code hash`); }

        return true;


Pure Javascript implementation of the BLAKE2b and BLAKE2s hash functions

Latest version published 2 years ago

Package Health Score

65 / 100
Full package analysis