Live data from Hacker News

Hashpipe – Pipe iff the hash matches

jbenet.github.io

11–20 of 90 posts

Re: Hashpipe – Pipe iff the hash matches

#14
post #5

Be warned that this reads everything until EOF into memory, doing something like: hashpipe QmUJPTFZnR2CPGAzmfdYPghgrFtYFB6pf1BqMvqfiPDam8 will produce unexpected behaviour.

yeah, hashes are decided by every single bit including the last one, and not a single bit should be output until the hash matches. It currently buffers everything in memory, but might do this: https://github.com/jbenet/hashpipe/issues/1 (some settings dont have disk though). hashpipe is intended for most executable use cases (usually under <50MB)

You should be able to detect if the stream is seekable (by checking the result of 'lseek(fd,0,SEEK_CUR)') and only buffer if it's not.

Of course, if you're really paranoid, the file could get changed out from under you. But honestly you're probably screwed either way with an attacker who can do that.

Re: Hashpipe – Pipe iff the hash matches

#19

Keep in mind whatever script you run through this could download additional unverified code.

Great point!! -- \o read this everyone o/ --

Please please dont use hashpipe thinking you'll be super safe about everything. It only raises the bar a bit! It solves my biggest gripe with most `curl | sh` things, which is that any MITM can own my machines without compromising the origin http servers.

(of course, if the HTTP server + page you got the checksum from is owned too-- good luck!).

Post reply on HN