-
-
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
identity hash #4697
Comments
All hashes in IPFS must be based on cryptographic hash functions. Multihash can (and does) support non-cryptographic hashes as well, but IPFS and IPLD hashes MUST be cryptographically verifiable. See #4371. |
It data itself. No need to publish it and no need to retrieve it. Data already there. See here why we need it : #4680 (comment) |
This is something I could work on assuming it is something that is wanted. cc @Stebalien |
Yes, this is definitely something we want (well, something I want). |
Okay I work on in within a week. |
I think it's OK to allow the identity hash function. You could argue it's cryptographically safe for the purposes of #4371 -- we may only need CRH? |
There are two main issue with not safe hashes: collisions allowing to fake the data and breaking principle of DAG (weak hashes allow creation of cyclic graphs by collisions). Those issues are not present in case of identity hash so I also think it is safe to use. |
Reposting a question from the internets:
|
@mib-kd743naq Multihash supports it but it isn't supported in go-ipfs for storing blocks (yet). |
@Stebalien does the |
@mib-kd743naq it means "we want this but nobody's actively working on it". Honestly, it shouldn't be that hard to implement, someone just needs to take it up and do it (I guess it warrants a "help wanted" in that case as well). |
I have thought a bit about this and can likely implement it in the next one or two weeks if it is something that is wanted now. |
@kevina It'd be amazing if you can do this. Here is a simple test case for you:
This should be a directory with a single 4 byte file containing |
I think the best way to implement this would be at the blockstore level. In particular I propose this is implemented as a wrapper blockstore (in the same way the cacheing blockstores are implemented) with the following semantics (when I say "pass on the request" I mean pass on the request to the underlying blockstore):
If this sounds good I will go ahead and implement it. CC @Stebalien |
SGTM. |
But the content is the hash, that line should be "noop if id-hash"... |
Yeah, that threw me as well. He's talking about verifying that the bytes returned by However, we can define special block type for identity Cids so we can check this invariant by doing a simple type check and only fall back on comparing bytes if we get a type that we're not expecting. |
Note: Working on this right now but have not pushed anything. Note that HashOnRead only applied when reading a hash from the BlockStore not storing it, so the new semantics of Put and PutMany is:
Sorry for the confusion. |
Version information:
go-ipfs version: 0.4.13-
Repo version: 6
System version: amd64/windows
Golang version: go1.9.2
Type: Feature
Description:
With identity hash we can inline data in link. Useful for short or zero length data.
Additional information:
z3vosKrgsh -> 01 55 00 03 00 00 00 is valid 3 bytes length "identity" hash of raw block with same length and data (00 00 00)
The text was updated successfully, but these errors were encountered: