Re: Hash functions

2010-12-22 Thread Boris Zbarsky
On 12/20/10 9:49 PM, Glenn Maynard wrote: Pushing gigabytes through it is plausible for most of these uses. OK. So we're talking multiple seconds even with a C hash implementation, right? I'm looking at 5 seconds per gigabyte here for the command-line utility I see. I guess at that point

Re: Hash functions

2010-12-22 Thread Charles Pritchard
On 12/21/2010 11:58 AM, Tab Atkins Jr. wrote: On Mon, Dec 20, 2010 at 5:49 PM, Boris Zbarskybzbar...@mit.edu wrote: On 12/20/10 7:42 PM, Glenn Maynard wrote: Has a hash functions API been considered, so browsers can expose, for example, a native SHA-1 implementation? Doing this in JS is

Re: Hash functions

2010-12-22 Thread Glenn Maynard
On Wed, Dec 22, 2010 at 4:39 PM, Charles Pritchard ch...@visc.us wrote: It'd be nice to see an SHA1 JS test case setup for performance testing using recent APIs like ArrayBuffer. These kinds of self-contained functions are low hanging fruit for compiler optimization. use strict, Typed Arrays

Re: Hash functions

2010-12-21 Thread Toni Ruottu
I would love even a painfully slow implementation provided by the browser. I have encountered lots of cases where being able to talk a protocol requires computing a sha1 or an md5 hash. Speed has never been the problem for me, but external javascript library dependencies are painful to maintain.

Re: Hash functions

2010-12-21 Thread Tab Atkins Jr.
On Mon, Dec 20, 2010 at 5:49 PM, Boris Zbarsky bzbar...@mit.edu wrote: On 12/20/10 7:42 PM, Glenn Maynard wrote: Has a hash functions API been considered, so browsers can expose, for example, a native SHA-1 implementation?  Doing this in JS is possible, but painfully slow, even with current

Re: Hash functions

2010-12-21 Thread Glenn Maynard
On Tue, Dec 21, 2010 at 2:58 PM, Tab Atkins Jr. jackalm...@gmail.com wrote: Notice that all three of the OP's use-cases were based on checksumming files.  I don't know how reading in a Blob and then hashing it would compare to just hashing an equivalent string, but I suspect it would have a

Re: Hash functions

2010-12-20 Thread Boris Zbarsky
On 12/20/10 7:42 PM, Glenn Maynard wrote: Has a hash functions API been considered, so browsers can expose, for example, a native SHA-1 implementation? Doing this in JS is possible, but painfully slow, even with current JS implementations. Before we go further into this, can we quantify

Re: Hash functions

2010-12-20 Thread Glenn Maynard
On Mon, Dec 20, 2010 at 8:49 PM, Boris Zbarsky bzbar...@mit.edu wrote: Or if I modify it to only calculate one hash, but have that be the hash of a 3,840,000 character string, I get times around 400ms. Running a command-line shasum utility on the same 3,840,000 characters (as ASCII in a file,