Re:Show HN: Calculate MD5, SHA-1 in your browser using HTML5...
by tptacek on Sunday September 18, 2011 @05:55PM
(#3011379)
Why would I want this?
By this I mean, what's an end-to-end use case for it? In which a user wants a SHA hash of a file, uses this thing to get it, and then does something with the hash.
Re:Show HN: Calculate MD5, SHA-1 in your browser using HTML5...
by chadkeck on Sunday September 18, 2011 @05:58PM
(#3011384)
Hey Thomas,
The itch I was scratching with this tool is that there isn't a built-in way in Windows to get a digest of a file, so... what better way than doing it in the browser?
Also, I'm the paranoid type and don't like the idea of uploading a file to someone else's server if I want the digest.
Re:Show HN: Calculate MD5, SHA-1 in your browser using HTML5...
by tptacek on Sunday September 18, 2011 @06:04PM
(#3011401)
You aren't worried that doing this via Javascript will make it insecure for that use? In almost the same manner as uploading your file to a server (simply to get the hash) would be?
Re:Show HN: Calculate MD5, SHA-1 in your browser using HTML5...
by chadkeck on Sunday September 18, 2011 @06:07PM
(#3011405)
I dont' really understand what you're saying here. Other services that calculate the digest of a file online require you to upload your file to the service/site where you don't know what they will do with it. With Browser Hash, not one bit of your file leaves your computer or travels over the network.
Re:Show HN: Calculate MD5, SHA-1 in your browser using HTML5...
by tptacek on Sunday September 18, 2011 @09:47PM
(#3011869)
How do I know that my file is never leaving my computer? To verify that, I have to verify every line of Javascript code influencing that page, every time I use it, to make sure it isn't spiriting away my file contents or feeding bogus SHA fingerprint values back to me.
Re:Show HN: Calculate MD5, SHA-1 in your browser using HTML5...
by antimatter15 on Sunday September 18, 2011 @06:25PM
(#3011455)
I think what xtacy means by MITM is that the javascript sent by the server might be MITM'd and altered to return a different value than the actual hash.
But for instance, if I'm trying to SHA1 a Windows 8 iso (the kind which I imagine would be by far the most common use case - in which a cryptographically secure hash algorithm isn't even a prerequisite any checksum would do).
It's not any worse than downloading the sha1sum app from any http site.
Re:Show HN: Calculate MD5, SHA-1 in your browser using HTML5...
by tptacek on Sunday September 18, 2011 @09:46PM
(#3011862)
No, it's worse than downloading the "sha1sum" app, because you only have to download "sha1sum" once. You can use a variety of out-of-band methods to verify the file that you can't reasonably or cost-effectively do with a website.
A website is essentially "installed" every time you visit it.
Re:Show HN: Calculate MD5, SHA-1 in your browser using HTML5...
by chadkeck on Sunday September 18, 2011 @06:12PM
(#3011426)
1. Haha, I agree that files will eventually become less accesible for the majority of computer users. Something like how the iPad handles projects/songs/documents instead of the generic "file".
2. Due to HTML5 limitations, you will need to drop the file from your local storage onto the browser window.
3. Yes you can get digests of a file on Windows, but it doesn't come with a built-in program.
Re:Show HN: Calculate MD5, SHA-1 in your browser using HTML5...
by antimatter15 on Sunday September 18, 2011 @06:31PM
(#3011468)
There's a certain cool factor of file drag/drop but I think that the click-to-browse paradigm is useful on certain laptop trackpads where dragging isn't a pleasure and other situations. It would be nice if you made the drag area clickable (like min.us).
Re:Show HN: Calculate MD5, SHA-1 in your browser using HTML5...
by thirsteh on Sunday September 18, 2011 @06:00PM
(#3011392)
This could be useful to validate large files after downloading them, e.g. ISO files for Linux distributions--however that goes out the window with the 10MB size limit.
Why the limit? Does it take too long to compute hashes for larger files?
Re:Show HN: Calculate MD5, SHA-1 in your browser using HTML5...
by antimatter15 on Sunday September 18, 2011 @06:28PM
(#3011462)
You could split up the file chunks by reading in sections (blob.webkitSlice and mozSlice) as array buffers and sending them to a worker object. Then you could process those in chunks with WebWorkers (or WebGL) and have a progress indicator.
Re:Show HN: Calculate MD5, SHA-1 in your browser using HTML5...
by re on Sunday September 18, 2011 @07:34PM
(#3011593)
Browser-based upload, but with file-hash-based deduping to skip the upload if possible, à la Dropbox? (Not a use-case for this site, but one for in-browser file hashing)
It's a Silverlight application I wrote years ago (as a warmup) and it does MD5, SHA1, SHA256, etc. and it is much faster than any Javascript or Flash implementation I've ever seen, including this one.
Apology for the very poor Google adsense placement and UI. Yeah it is embarrassing. It was my first introduction to web programming, Google Adsense, and UI, and I've moved on from it long ago. Needless to say I have learned a lot since then.
Hashsum can handle much bigger files than 10MB. In fact, for a file that small, you won't even notice that it did anything. Try something bigger, like a DVD-sized ISO (4.7GB) which will take about 1 or 2 minutes. All computation is done on the client side.
Anyone who claims Javascript is "as fast as C/C++" should at least try to beat Hashsum, which is only C# based.
Sadly, Microsoft is putting an end to this amazing technology, but that's another story.
Re:Show HN: Calculate MD5, SHA-1 in your browser using HTML5...
by ericb on Sunday September 18, 2011 @06:15PM
(#3011431)
What is the license? I haven't looked too closely yet, but I might want to borrow some of the JS for a firefox plugin where I'd want to calculate hashes.
By this I mean, what's an end-to-end use case for it? In which a user wants a SHA hash of a file, uses this thing to get it, and then does something with the hash.
Also, I'm the paranoid type and don't like the idea of uploading a file to someone else's server if I want the digest.
But for instance, if I'm trying to SHA1 a Windows 8 iso (the kind which I imagine would be by far the most common use case - in which a cryptographically secure hash algorithm isn't even a prerequisite any checksum would do).
It's not any worse than downloading the sha1sum app from any http site.
A website is essentially "installed" every time you visit it.
On a serious note, can one drop an attachment from say gmail onto that?
And dear someone, please tell me that sha1sum & friends exists for Windows!
2. Due to HTML5 limitations, you will need to drop the file from your local storage onto the browser window.
3. Yes you can get digests of a file on Windows, but it doesn't come with a built-in program.
Why the limit? Does it take too long to compute hashes for larger files?
It regularly crashes(!) Chrome on "large" files; thus, the limitation.
It's a Silverlight application I wrote years ago (as a warmup) and it does MD5, SHA1, SHA256, etc. and it is much faster than any Javascript or Flash implementation I've ever seen, including this one.
Apology for the very poor Google adsense placement and UI. Yeah it is embarrassing. It was my first introduction to web programming, Google Adsense, and UI, and I've moved on from it long ago. Needless to say I have learned a lot since then.
Hashsum can handle much bigger files than 10MB. In fact, for a file that small, you won't even notice that it did anything. Try something bigger, like a DVD-sized ISO (4.7GB) which will take about 1 or 2 minutes. All computation is done on the client side.
Anyone who claims Javascript is "as fast as C/C++" should at least try to beat Hashsum, which is only C# based.
Sadly, Microsoft is putting an end to this amazing technology, but that's another story.
Also, cache manifest.
The hash functions came from Paj here: http://pajhome.org.uk/crypt/md5/
IIRC, Firefox's add-on API already has an MD5 calculation method.