-
-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Explicitly set default encoding in createHash() #5
Conversation
Up until now, the default encoding for this is `binary`, but this is scheduled to change in Node 8. Since this module is currently always passing string input to the `Hash` object, it needs to account for that. A better fix would likely involve dropping all strings handling and treating binary data using Buffer objects, but I kept this change minimal to avoid any breakage. Refs: nodejs/node#8611
Also, fyi: This code is not optimal anyway. One of the reasons for switching the default encoding to UTF-8 is that it actually affects security – with |
I'll try to look at this PR this weekend.
It's like that because the checksums for Electron are generated with the |
Thanks!
What I meant was that, while you can process binary data using that encoding, it would be a bit more customary to not apply any string encoding/decoding at all and just use |
Bump @malept – This PR really only explicitly sets the |
I didn't have time this weekend to look at it mostly because of the backporting part. However, I did just push a v1 branch that you can submit a PR against. |
@malept thanks, done! |
Fails to install using Node 8; see: - electron-userland/electron-prebuilt#264 - malept/sumchecker#5 Tried this: ``` yarn upgrade electron electron-download sumchecker ``` But it blows up due to the checksum "mismatch". Worked around that by downgrading to 7 temporarily: ``` brew install n sudo n 7.10.1 yarn upgrade electron sudo n latest ```
Up until now, the default encoding for this is
binary
, but this is scheduled to change in Node 8. Since this module is currently always passing string input to theHash
object, it needs to account for that.A better fix would likely involve dropping all strings handling and treating binary data using Buffer objects, but I kept this change minimal to avoid any breakage.
Refs: nodejs/node#8611
@malept Could you backport this change to the 1.x.x versions of
sumchecker
? This came up because a major dependent of sumchecker,electron-prebuilt
, would be affected by the change in Node, and it still supports 0.10.x/0.12.x Node versions.