-
Notifications
You must be signed in to change notification settings - Fork 18
Use sha.js
instead of full crypto in browser
#10
base: master
Are you sure you want to change the base?
Conversation
Failure in Travis is due to lint complaining about digest function names: ''' I suppose it could be fixed, since I guess these aren't called externally. |
To make this really efficient we need to do a bit more work, What we want is something like this let createHash
if (buildingForBrowser) {
createHash = require('sha.js')
} else {
createHash = require('crypto').createHash
} and then let our build tool define let createHash
if (true) {
createHash = require('sha.js')
} else {
// unreachable code
createHash = require('crypto').createHash
} This in turn would be then properly analyzable by webpack & uglify and they could remove the unreachable code. |
In Node.js the underlying hashing functions have not changed, but the browser now uses `webcrypto` instead of JavaScript based methods for `SHA1`, `SHA2-256` and `SHA2-512`. Also `SHA3` support was added in both Node.js and the browser. BREAKING CHANGE: The api was changed to be callback based, as webcrypto only exposes async methods. Closes #10
@pelle did you had the chance to check @dignifiedquire suggestions? |
Sorry I missed this. I guess I was at devcon and all was a blur. Having a look now. |
Looks great. Great progress @dignifiedquire and @diasdavid |
can also set |
@diasdavid I think this one could be closed since it is a bit old, has a lot of conflicts, and |
@hacdias only multihashing-async is using webcrypto, not this one. |
Oh. Sorry. Should we use web crypto on this one too?
…On Tue, 2 Jan 2018 at 17:17, David Dias ***@***.***> wrote:
@hacdias <https://github.com/hacdias> only multihashing-async is using
webcrypto, not this one.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#10 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AFMdsK2uTRZ3h2MsOFDd6dMzYsgjfKNnks5tGmSvgaJpZM4JpVIB>
.
|
@hacdias the thing is that you can't. WebCrypto is async only (that is why there is a multihashing-async) |
Only use sha.js per suggestions from @dignifiedquire here ipfs-inactive/js-ipfs-http-client#353
Not sure how much of an effect it will have on the distribution size