@@ -20,7 +20,8 @@ extern "C" {
20
20
#include " cryptonight.h"
21
21
#include " x13.h"
22
22
#include " nist5.h"
23
- #include " sha1.h"
23
+ #include " sha1.h" ,
24
+ #include " x15.h"
24
25
}
25
26
26
27
#include " boolberry.h"
@@ -528,6 +529,28 @@ Handle<Value> sha1(const Arguments& args) {
528
529
return scope.Close (buff->handle_ );
529
530
}
530
531
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
+
531
554
void init (Handle <Object> exports) {
532
555
exports->Set (String::NewSymbol (" quark" ), FunctionTemplate::New (quark)->GetFunction ());
533
556
exports->Set (String::NewSymbol (" x11" ), FunctionTemplate::New (x11)->GetFunction ());
@@ -549,6 +572,7 @@ void init(Handle<Object> exports) {
549
572
exports->Set (String::NewSymbol (" boolberry" ), FunctionTemplate::New (boolberry)->GetFunction ());
550
573
exports->Set (String::NewSymbol (" nist5" ), FunctionTemplate::New (nist5)->GetFunction ());
551
574
exports->Set (String::NewSymbol (" sha1" ), FunctionTemplate::New (sha1)->GetFunction ());
575
+ exports->Set (String::NewSymbol (" x15" ), FunctionTemplate::New (x13)->GetFunction ());
552
576
}
553
577
554
578
NODE_MODULE (multihashing, init)
0 commit comments