Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ Algorithms
* quark
* x11
* x13
* x15
* nist5
* scrypt
* scryptn
Expand All @@ -28,6 +29,8 @@ Algorithms
* shavite3
* cryptonight
* boolberry
* yescrypt
* neoscrypt

Usage
-----
Expand Down
1 change: 1 addition & 0 deletions binding.gyp
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
"sha1.c",
"x15.c",
"fresh.c",
"neoscrypt.c",
"sha3/sph_hefty1.c",
"sha3/sph_fugue.c",
"sha3/aes_helper.c",
Expand Down
29 changes: 26 additions & 3 deletions multihashing.cc
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,10 @@ extern "C" {
#include "quark.h"
#include "scryptjane.h"
#include "scryptn.h"
#include "yescrypt/yescrypt.h"
#include "neoscrypt.h"
#include "yescrypt/yescrypt.h"
#include "yescrypt/sha256_Y.h"
#include "skein.h"
#include "skein.h"
#include "x11.h"
#include "groestl.h"
#include "blake.h"
Expand All @@ -22,7 +23,7 @@ extern "C" {
#include "cryptonight.h"
#include "x13.h"
#include "nist5.h"
#include "sha1.h",
#include "sha1.h"
#include "x15.h"
#include "fresh.h"
}
Expand Down Expand Up @@ -107,6 +108,27 @@ Handle<Value> scrypt(const Arguments& args) {
return scope.Close(buff->handle_);
}

Handle<Value> neoscrypt_hash(const Arguments& args) {
HandleScope scope;

if (args.Length() < 2)
return except("You must provide two arguments.");

Local<Object> target = args[0]->ToObject();

if(!Buffer::HasInstance(target))
return except("Argument should be a buffer object.");

char * input = Buffer::Data(target);
char output[32];

uint32_t input_len = Buffer::Length(target);

neoscrypt(input, output, 0);

Buffer* buff = Buffer::New(output, 32);
return scope.Close(buff->handle_);
}


Handle<Value> scryptn(const Arguments& args) {
Expand Down Expand Up @@ -622,6 +644,7 @@ void init(Handle<Object> exports) {
exports->Set(String::NewSymbol("sha1"), FunctionTemplate::New(sha1)->GetFunction());
exports->Set(String::NewSymbol("x15"), FunctionTemplate::New(x15)->GetFunction());
exports->Set(String::NewSymbol("fresh"), FunctionTemplate::New(fresh)->GetFunction());
exports->Set(String::NewSymbol("neoscrypt"), FunctionTemplate::New(neoscrypt_hash)->GetFunction());
}

NODE_MODULE(multihashing, init)
Loading