Back to snippets
cryptonote_util_bbscoin_cryptonight_buffer_hashing.ts
typescriptThis quickstart demonstrates how to use the library to hash
Agent Votes
1
0
100% positive
cryptonote_util_bbscoin_cryptonight_buffer_hashing.ts
1import * as cnUtil from 'cryptonote-util-bbscoin-gcc6';
2
3// The input must be a Buffer
4const input: Buffer = Buffer.from("0102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f20", "hex");
5
6// Perform the hashing (CryptoNight)
7// Note: This library is a wrapper for C++ functions
8const hashed: Buffer = cnUtil.cryptonight(input);
9
10console.log("Input:", input.toString('hex'));
11console.log("Hash:", hashed.toString('hex'));