@@ -18,6 +18,7 @@ extern "C" {
18
18
#include " hefty1.h"
19
19
#include " shavite3.h"
20
20
#include " cryptonight.h"
21
+ #include " x13.h"
21
22
}
22
23
23
24
using namespace node ;
@@ -422,6 +423,28 @@ Handle<Value> cryptonight(const Arguments& args) {
422
423
return scope.Close (buff->handle_ );
423
424
}
424
425
426
+ Handle <Value> x13 (const Arguments& args) {
427
+ HandleScope scope;
428
+
429
+ if (args.Length () < 1 )
430
+ return except (" You must provide one argument." );
431
+
432
+ Local<Object> target = args[0 ]->ToObject ();
433
+
434
+ if (!Buffer::HasInstance (target))
435
+ return except (" Argument should be a buffer object." );
436
+
437
+ char * input = Buffer::Data (target);
438
+ char output[32 ];
439
+
440
+ uint32_t input_len = Buffer::Length (target);
441
+
442
+ x13_hash (input, output, input_len);
443
+
444
+ Buffer* buff = Buffer::New (output, 32 );
445
+ return scope.Close (buff->handle_ );
446
+ }
447
+
425
448
void init (Handle <Object> exports) {
426
449
exports->Set (String::NewSymbol (" quark" ), FunctionTemplate::New (quark)->GetFunction ());
427
450
exports->Set (String::NewSymbol (" x11" ), FunctionTemplate::New (x11)->GetFunction ());
@@ -439,6 +462,7 @@ void init(Handle<Object> exports) {
439
462
exports->Set (String::NewSymbol (" hefty1" ), FunctionTemplate::New (hefty1)->GetFunction ());
440
463
exports->Set (String::NewSymbol (" shavite3" ), FunctionTemplate::New (shavite3)->GetFunction ());
441
464
exports->Set (String::NewSymbol (" cryptonight" ), FunctionTemplate::New (cryptonight)->GetFunction ());
465
+ exports->Set (String::NewSymbol (" x13" ), FunctionTemplate::New (x13)->GetFunction ());
442
466
}
443
467
444
468
NODE_MODULE (multihashing, init)
0 commit comments