cryptonight-hash
JavaScript crytonight hash generation interface
Requeriment
To create the WASM file you will need Emscripten
git clone https://github.com/juj/emsdk.gitcd emsdk # on Linux or Mac OS X ./emsdk install --build=Release sdk-incoming-64bit binaryen-master-64bit./emsdk activate --global --build=Release sdk-incoming-64bit binaryen-master-64bit # on Windows emsdk install --build=Release sdk-incoming-64bit binaryen-master-64bitemsdk activate --global --build=Release sdk-incoming-64bit binaryen-master-64bit
Build
#!/bin/bash emcc cryptonight.c crypto/*.c -O0 \ -s DISABLE_EXCEPTION_CATCHING=1 \ -s BINARYEN_ASYNC_COMPILATION=1 \ -s ALIASING_FUNCTION_POINTERS=0 \ -s ALLOW_MEMORY_GROWTH=1 \ -s VERBOSE=1 \ -s WASM=1 \ -s BINARYEN=1 \ -s NO_EXIT_RUNTIME=1 \ -s ASSERTIONS=1 \ -s SAFE_HEAP=0 \ -s STACK_OVERFLOW_CHECK=0 \ -s BINARYEN_METHOD="'native-wasm'" \ -s BINARYEN_TRAP_MODE="'js'" \ -s EXPORTED_FUNCTIONS="['_cryptonight_hash']" \ -o ./cryptonight.js
Or
$ sudo chmod +x ./build.sh$ ./build.sh
Usage
The use is very simple, just follow the official guidelines in Cryptonote https://github.com/cryptonotefoundation/cryptonote
const criptonight = ; var heap = criptonightHEAPU8buffer;var input = heap criptonight 84;var output = heap criptonight 32; var nonce = Math * 4294967295 + 1 >>> 0;input39 = nonce & 4278190080 >> 24;input40 = nonce & 16711680 >> 16;input41 = nonce & 65280 >> 8;input42 = nonce & 255 >> 0; criptonight;console;
Donate
XMR wallet: 47TVQKg7VJCN6VVwwkfkPh8WWdpQK6T4c2iW9dAWFiyTjYkEFnatGt8bhbkPcAdRUhBGRtT1cASQiiAoZzbGx6t8UxW2hzP