starbelly / hydro

Libhydrogen bindings for Erlang
MIT License
20 stars 2 forks source link

Can you make a generic hashing API? #1

Closed lin7sh closed 5 years ago

lin7sh commented 6 years ago

Hi The Gimli is very interesting, But I can't find a generic hashing API in Hydro, but it's in libhydrogen. Can you write more API Nifs to make it useful for hashing

thanks

starbelly commented 6 years ago

@mko-io Absolutely. This is on the TODO list for soda as well as requested by @benoitc. Currently am very busy, I will make a soft promise of by next week though. Of course, PRs are welcome too ;) Thank you people for your patience 🙏

Also, I'm not sure why but I have not been getting notifications 🤔

lin7sh commented 6 years ago

@starbelly I wish I could help, but currently I don't have the experience with NIF. Your erlang projects is very minimalistic which I like and the naming is terrific!

starbelly commented 6 years ago

No worries @mko-io, I got you covered. Once again appreciate the patience 👍

starbelly commented 5 years ago

Have not forgot about this. Should have time over the next few days at this point.

starbelly commented 5 years ago

Finally got a chance to start on this. One thing I don't like is that we will have to pass a size to the hash_init functions. In erlang we have to allocate a resource for the state and this requires a size, which really does not does an injustice in regards the elegance of the underlying hydro function... but I can. think of worse things.

lin7sh commented 5 years ago

I think for Erlang convention hash_init/1 is a streamed version of the hash function, if we have to forced to pass a size for now, we can use a blocked version like make_hash/1 for now.

starbelly commented 5 years ago

Yeah, I was thinking on that... and for crypto generic hash in soda as well... Basically, I could not think of a sane default to allocate. If we go with a default size and the caller adds more to the state than is allocated then we will overflow.

lin7sh commented 5 years ago

I wish I knew some C to help you working on that.

starbelly commented 5 years ago

HAHA no worries. I enjoy this stuff :)

starbelly commented 5 years ago

Cheers :)

lin7sh commented 5 years ago

good work !

starbelly commented 5 years ago

More to come. Gonna put a good bit of work into this over the next few weeks. Need better doc, need more/better tests, need to expose the rest of the API.

starbelly commented 5 years ago

@mko-io https://github.com/starbelly/hydro/releases/tag/v0.3.0

lin7sh commented 5 years ago

awesome! It will be very useful for micro controller