Use ex_multihash instead of :crypto.hash(:sha512, input)
- Dominant language
- Elixir
- Stars
- 38
- Forks
- 4
- PR merge metrics
- No merged PRs in 30d
Description
At present, the Erlang `:crypto.hash(:sha512, input)` is called _directly_ when creating a `cid`:
https://github.com/dwyl/cid/blob/3e8eb8267a7045910381dbe16bcce87f97922694/lib/cid.ex#L25
In light of the fact that https://github.com/ipld/cid achieves a pretty similar goal,
I propose that we use `multihash` instead of directly creating a `:sha512` hash.
This will ensure forward compatibility and also mean that we can use the JS `cid` function on the client.
# Todo
+ [x] figure out how to use https://github.com/multiformats/ex_multihash to hash content.
+ [x] At present the [ex_multihash/test/multihash_test.exs](https://github.com/multiformats/ex_multihash/blob/dd3ce7e39d053049dbd7219c2aba2dbde9940bb2/test/multihash_test.exs) is only doing a doctest ... 🙄
https://github.com/multiformats/ex_multihash/blob/dd3ce7e39d053049dbd7219c2aba2dbde9940bb2/test/multihash_test.exs#L3
+ [x] Create tests for https://github.com/multiformats/ex_multihash 🆕
+ [x] Submit a Pull Request with the tests.
+ [x] See if it gets accepted! 🤞
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.