package cid
Content-addressed Identifiers
Install
Dune Dependency
Authors
Maintainers
Sources
cid-0.1.0.tbz
sha256=541f53b7cdc62b9860d8dc5a6856759da34395a71ba4cf2dbdaade522fe65bf3
sha512=0db58f25180158ae0fd2b0539ab645f5cd316965d3c014abfc6f13d1ded88da348919713f3518316fbb04e4c25bc5978f24dfff4ea5bb2b92d3f0f55bd870c59
doc/index.html
Content Identifiers
The Cid
library provides a pure OCaml interface to Content Identifiers. These are like pointers to bits of data derived from the data itself. They are based on the cryptographic hash of the data along with extra information describing things like the encoding of the data, the hash function used to produce the digest etc.
For a thorough handling of this information see the IPFS documentation.
Quick Example
A very small example using Cid.of_string
and the human-readable pretty printer Cid.pp_human
.
let s = "zb2rhe5P4gXftAwvA4eXQ5HJwsER2owDyS9sKaQRRVQPn93bA"
let cid = Cid.of_string s |> Result.get_ok
let () = Cid.pp_human Format.std_formatter cid
Which would print the following:
cidv1 - base58btc - raw - ident(sha2-256) length(32)
digest(6e 6f f7 95 0a 36 18 7a 80 16 13 42 6e 85 8d ce
68 6c d7 d7 e3 c0 fc 42 ee 03 30 07 2d 24 5c 95)
If instead we used Cid.to_string
this will base encode this for us producing the original input.
The repository also contains an example of using Irmin and CIDs together. This is similar to the idea of using CIDs in IPFS.
sectionYPositions = computeSectionYPositions($el), 10)"
x-init="setTimeout(() => sectionYPositions = computeSectionYPositions($el), 10)"
>
On This Page