@@ -73,7 +73,12 @@ using namespace v8;
7373 \
7474 uint32_t input_len = Buffer::Length (target); \
7575 \
76- hash (input, output, input_len); \
76+ if (info.Length () >= 2 ) { \
77+ unsigned int keyValue = Nan::To<uint32_t >(info[1 ]).ToChecked (); \
78+ hash (input, output, input_len, keyValue); \
79+ } else { \
80+ hash (input, output, input_len); \
81+ } \
7782 \
7883 SET_BUFFER_RETURN (output, output_len); \
7984}
@@ -384,36 +389,6 @@ DECLARE_FUNC(boolberry) {
384389 SET_BUFFER_RETURN (output, 32 );
385390}
386391
387- DECLARE_FUNC (odo) {
388- if (info.Length () < 2 )
389- RETURN_EXCEPT (" You must provide buffer to hash and key value" );
390-
391- #if NODE_MAJOR_VERSION >= 12
392- Local<Object> target = Nan::To<Object>(info[0 ]).ToLocalChecked ();
393- #else
394- Local<Object> target = Nan::To<Object>(info[0 ]).ToLocalChecked ();
395- #endif
396-
397- if (!Buffer::HasInstance (target))
398- RETURN_EXCEPT (" Argument should be a buffer object." );
399-
400- #if NODE_MAJOR_VERSION >= 12
401- Local<Context> currentContext = isolate->GetCurrentContext ();
402- unsigned int keyValue = info[1 ]->Uint32Value (currentContext).FromJust ();
403- #else
404- unsigned int keyValue = info[1 ]->Uint32Value ();
405- #endif
406-
407- char * input = Buffer::Data (target);
408- char output[32 ];
409-
410- uint32_t input_len = Buffer::Length (target);
411-
412- odo_hash (input, output, input_len, keyValue);
413-
414- SET_BUFFER_RETURN (output, 32 );
415- }
416-
417392NAN_MODULE_INIT (init) {
418393 NAN_EXPORT (target, argon2d);
419394 NAN_EXPORT (target, argon2i);
@@ -454,4 +429,4 @@ NAN_MODULE_INIT(init) {
454429 NAN_EXPORT (target, neoscrypt);
455430}
456431
457- NAN_MODULE_WORKER_ENABLED (multihashing, init);
432+ NAN_MODULE_WORKER_ENABLED (multihashing, init);
0 commit comments