Skip to content
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

Use native browser sha1 implementation when possible #234

Closed
feross opened this issue Jan 4, 2015 · 2 comments
Closed

Use native browser sha1 implementation when possible #234

feross opened this issue Jan 4, 2015 · 2 comments

Comments

@feross
Copy link
Member

@feross feross commented Jan 4, 2015

Most of the the browser's time is spent in git-sha1 when creating a torrent. This is unsurprising, since the file must be split into pieces and hashed. But, this currently locks the entire browser for seconds.

Is the browser's native sha1 implementation faster? It's already shipped in Chrome and Firefox. See: http://caniuse.com/#feat=cryptography

  • Test that crypto.subtle is actually faster
  • Compare Rusha and current git-sha as fallback for insecure origins and older browsers
  • File bug on Chrome and the spec to complain that crypto.subtle is only available on https: sites (https://instant.io is https, but other sites that use webtorrent might not be). Comment on this issue: https://code.google.com/p/chromium/issues/detail?id=373032

Related issue: webtorrent/create-torrent#4

astro added a commit to astro/webtorrent that referenced this issue Jan 4, 2015
@astro

This comment has been minimized.

Copy link
Contributor

@astro astro commented Jan 4, 2015

It looks like simple-sha1 has the right aims: to provide the fastest implementation available. crypto.subtle support should be implemented there.

@feross

This comment has been minimized.

Copy link
Member Author

@feross feross commented Jan 5, 2015

This is done now. Released as 0.22.0.

  • crypto.subtle is actually faster
  • Rusha is faster than git-sha1
  • Will file bugs on chrome later
@feross feross closed this Jan 5, 2015
@lock lock bot locked as resolved and limited conversation to collaborators May 6, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.