Skip to content

Commit

Permalink
Fix shown hash method, if was set by user
Browse files Browse the repository at this point in the history
  • Loading branch information
animetosho committed Oct 17, 2023
1 parent 3dec096 commit f3719fe
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
4 changes: 2 additions & 2 deletions lib/par2.js
Original file line number Diff line number Diff line change
Expand Up @@ -958,10 +958,10 @@ module.exports = {
return binding.set_HasherOutput(getMethodNum(OUTHASH_METHODS, method));
},
get_inhash_methodDesc: function() {
return binding.hasherInput_method;
return binding.hasherInput_method();
},
get_outhash_methodDesc: function() {
return binding.hasherOutput_method;
return binding.hasherOutput_method();
},

_extend: Object.assign || function(to) {
Expand Down
12 changes: 10 additions & 2 deletions src/gf.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1241,6 +1241,14 @@ FUNC(SetHasherOutput) {
RETURN_UNDEF;
}

FUNC(HasherInputMethod) {
FUNC_START;
RETURN_VAL(NEW_STRING(hasherInput_methodName()));
}
FUNC(HasherOutputMethod) {
FUNC_START;
RETURN_VAL(NEW_STRING(hasherMD5Multi_methodName()));
}


void parpar_gf_init(
Expand Down Expand Up @@ -1276,10 +1284,10 @@ void parpar_gf_init(

NODE_SET_METHOD(target, "set_HasherInput", SetHasherInput);
NODE_SET_METHOD(target, "set_HasherOutput", SetHasherOutput);
NODE_SET_METHOD(target, "hasherInput_method", HasherInputMethod);
NODE_SET_METHOD(target, "hasherOutput_method", HasherOutputMethod);

setup_hasher();
SET_OBJ(target, "hasherInput_method", NEW_STRING(hasherInput_methodName()));
SET_OBJ(target, "hasherOutput_method", NEW_STRING(hasherMD5Multi_methodName()));
}

NODE_MODULE(parpar_gf, parpar_gf_init);

0 comments on commit f3719fe

Please sign in to comment.