Re: Hash functions

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.

  --Toni

On Tue, Dec 21, 2010 at 2:42 AM, Glenn Maynard <glenn@zewt.org> 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.
>
> Some fairly obvious use cases:
>
>  - Avoid uploading a file to the server if it already has a copy.  For
> example, if you attach a large file to an email, and you already have
> a copy of that file in your mailbox attached to another mail, don't
> upload the whole file; just send a reference the existing one.
>  - Resumable file uploads.  An implementation of a chunked, resumable
> uploader will want to validate that the file the user is sending is
> actually what's been received by the server so far, and roll back the
> transfer partially or completely if they're out of sync.
>  - Local file validation and updating.  A web-based game may want to
> save large blocks of resources locally, rather than depending on HTTP
> caching to do it, which is inappropriate for a game with several
> hundred megabytes or more of resources.  Native hashing would help
> automatic updating of data.
>
> If there's a more appropriate place for this, let me know.
>
> --
> Glenn Maynard
>
>

Received on Tuesday, 21 December 2010 16:38:34 UTC