-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ipfs add
with exotic hash functions panics (the daemon and the client)
#9297
Comments
The rational about sha1 is explained here: #8650 (comment) The panic is indeed not nice, I'll fix that. FWIW The list of allowed hash functions is here: This could be documented better, this is less important to fix tho. |
Nice, thanks :) |
Also about sha1 being broken. It is still belived to by cryptographically impossible to find a collision for a given a random precise target hash. What has been proven is collisions when the attacker control both files. In other words, if I add some files with sha1 you cannot find a collision that will let you replace my files with yours. However you can find two files (that you control) which have the same hash. This is an issue if you start trusting other peoples files. So it's not that bad (you shouldn't use it tho). |
I mostly agree with your stance on SHA1, I was just surprised by the behavior of the client :) Edit: While I have you here -- I think some of those functions have variable output sizes, like blake3 (and all the Keccaks and SHA3?). If that's true, are there plans to specify this via Edit2: reorganizing comments... |
Blake3 support variable sized digest but only for the verification (up to 128 bytes because I had no clue what limit I should have put in). SHA3 and Keccaks were added at a time where we didn't supported variable sized digests in You can lookup how blake3 verification is implemented if you want to submit a PR to have variable sha3 and keccak: |
… hashing function"" I was too much trigger happy and caught ipfs#9297's regression test in the workaround revert.
… hashing function"" I was too much trigger happy and caught #9297's regression test in the workaround revert.
Checklist
Installation method
ipfs-update or dist.ipfs.tech
Version
Config
default
Description
Hello! :)
I'm experimenting a bit with more exotic hash functions and
ipfs add
.For that, I'm adding some ~5MiB binary via
ipfs add --only-hash --cid-version 1 --hash <hash function> <file>
It's not clear from the documentation which functions are supported, but a quick skim through the source led to
go-multihash/Names
, and indeed these are accepted by the client (and daemon, I guess).This all works for normal hash functions (SHA2, SHA3, ...), but behaves weirdly for more exotic ones.
poseidon-bls12_381-a2-fc1
,x11
,sha2-256-trunc254-padded
, with a running daemon causesError: write tcp 127.0.0.1:45460->127.0.0.1:5001: write: connection reset by peer
on the CLI, and the daemon panics:Trying again then panics the client:
murmur3-x64-64
andmd5
returnError: potentially insecure hash functions not allowed
, which is surprising seeing how SHA1 is accepted, maybe. This is mostly fine, but it looks like I'm streaming some of the data to the daemon, it's starting to chunk, and then decides "no, I won't give you the CID".Expected Behavior
ipfs add
The text was updated successfully, but these errors were encountered: