Hash functions

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 00:42:47 UTC