hash/hashSync functions don't take the params object correctly - #119
Conversation
barrysteyn
commented
Feb 18, 2016
This is by design, and is in fact how the raw "hash" function is implemented in the original Scrypt implementation. I think that Colin Percival's thinking is that one can put whatever input the hash function they like (even if it is incorrect). Why don't you speak to him and ask him about this question. |
barrysteyn
commented
Feb 18, 2016
Sorry, I may have been too quick to examine this issue. I will look into this evening or tomorrow when I have some more time. |
jrnewell
commented
Feb 20, 2016
Either way is fine with me... it is just a little weird IMO that it very similar to the It kind of implies that you should use the output of the params function. Took me a while to figure out why it would sometimes work (I would get back 16 sometimes) and sometimes crap out. I probably should have paid more attention to the example sections later on 😄 That being said, I can see the argument against changing it since there are probably a few projects that depend on this behavior and it is consistent with the original library. Anyway, thanks for responding! |
BrandonZacharie
commented
Mar 22, 2016
I also ran in to this recently. I vote for this PR but updating the documentation to make it clear that there are two versions of |
barrysteyn
commented
Mar 22, 2016
Okay, let me look into this. give me a day or so please... |
barrysteyn
commented
Oct 19, 2016
I will update package.json soon |
barrysteyn
commented
Oct 19, 2016
Okay, I need to update the documentation before I update the package.json. This is a breaking change, so version 7, here we come! Any objections? |
chrisveness
commented
Oct 19, 2016
LGTM (though the current documentation documents the fixed behaviour, so you just need to document it as a (potentially breaking) bug fix, I guess). What needs to change in package.json? (other than version bump). |
jordanbtucker
commented
Feb 14, 2017
Any update on when this is going to hit NPM? I just encountered this issue too, and it took way too long to figure it out because the documentation still hasn't been updated to say that the params from |
nathanph
commented
Mar 2, 2017
Also just ran into this issue. What's the holdup on this? You should at least update the readme if you're not going to publish this to GitHub. |
barrysteyn
commented
Mar 2, 2017
I am trying to find some time to update this module in a big way... I am thinking I will get that time near the end of March. |
@barrysteyn do you have any objection to merging my PR #141? It will at least warn people if they are using N rather than logN. Whether or not you wish to update the documentation at all, I think this check would be valuable. As it only implements a RangeError check, I don't think it could be considered a breaking change. Edit: you could do that in anticipation of any major changes, and get it out quickly! |
barrysteyn
commented
Mar 2, 2017
@chrisveness I do not. But look at #150 - I want to correct it over there. I am not anywhere near my home PC since I am traveling for business. All my keys are there, so I will need to get home before I am able to merge and publish. |
The N parameter of the params/paramsSync output object is a power of base 2. However the hash functions except a raw value for N unlike the kdf functions which do the power transformation internally. This PR changes the hash functions to execute the power transformation internally too, so it can the params object directly.