Skip to content

Commit 8a4e442

Browse files
committed
Added initial x15 support
1 parent cb6fd1f commit 8a4e442

9 files changed

+5336
-1
lines changed

binding.gyp

+3
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
"boolberry.cc",
2323
"nist5.c",
2424
"sha1.c",
25+
"x15.c",
2526
"sha3/sph_hefty1.c",
2627
"sha3/sph_fugue.c",
2728
"sha3/aes_helper.c",
@@ -36,6 +37,8 @@
3637
"sha3/sph_shavite.c",
3738
"sha3/sph_simd.c",
3839
"sha3/sph_skein.c",
40+
"sha3/sph_whirlpool.c",
41+
"sha3/sph_shabal.c",
3942
"sha3/hamsi.c",
4043
"crypto/oaes_lib.c",
4144
"crypto/c_keccak.c",

multihashing.cc

+25-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@ extern "C" {
2020
#include "cryptonight.h"
2121
#include "x13.h"
2222
#include "nist5.h"
23-
#include "sha1.h"
23+
#include "sha1.h",
24+
#include "x15.h"
2425
}
2526

2627
#include "boolberry.h"
@@ -528,6 +529,28 @@ Handle<Value> sha1(const Arguments& args) {
528529
return scope.Close(buff->handle_);
529530
}
530531

532+
Handle<Value> x15(const Arguments& args) {
533+
HandleScope scope;
534+
535+
if (args.Length() < 1)
536+
return except("You must provide one argument.");
537+
538+
Local<Object> target = args[0]->ToObject();
539+
540+
if(!Buffer::HasInstance(target))
541+
return except("Argument should be a buffer object.");
542+
543+
char * input = Buffer::Data(target);
544+
char output[32];
545+
546+
uint32_t input_len = Buffer::Length(target);
547+
548+
x15_hash(input, output, input_len);
549+
550+
Buffer* buff = Buffer::New(output, 32);
551+
return scope.Close(buff->handle_);
552+
}
553+
531554
void init(Handle<Object> exports) {
532555
exports->Set(String::NewSymbol("quark"), FunctionTemplate::New(quark)->GetFunction());
533556
exports->Set(String::NewSymbol("x11"), FunctionTemplate::New(x11)->GetFunction());
@@ -549,6 +572,7 @@ void init(Handle<Object> exports) {
549572
exports->Set(String::NewSymbol("boolberry"), FunctionTemplate::New(boolberry)->GetFunction());
550573
exports->Set(String::NewSymbol("nist5"), FunctionTemplate::New(nist5)->GetFunction());
551574
exports->Set(String::NewSymbol("sha1"), FunctionTemplate::New(sha1)->GetFunction());
575+
exports->Set(String::NewSymbol("x15"), FunctionTemplate::New(x13)->GetFunction());
552576
}
553577

554578
NODE_MODULE(multihashing, init)

0 commit comments

Comments
 (0)