Closed jtraglia closed 1 year ago
A couple other repos that would benefit from this change are nim-blscurve (current workaround to expose sha256 at https://github.com/status-im/nim-blscurve/blob/master/blscurve/blst/blst_sha256.c) and the in-progress nim-kzg-4844 repo.
I don't see a compelling need for exposing the CTX structure. I mean why not instead of exposing init/update/final expose single-shot subroutine? One that simply takes data and emits its hash... With private CTX allocated on stack...
I mean
void blst_sha256(unsigned char md[32], const void *msg, size_t len)
{
SHA256_CTX ctx;
sha256_init(&ctx);
sha256_update(&ctx, msg, len);
sha256_final(md, &ctx);
}
for src/exports.c.
That's a good idea too. I like that approach. Will make the change.
Any hard objections, @henridf?
nope, I think this should work fine on my end too
Thanks!
This PR exposes the blst sha256 functions in the auxiliary header. This is for c-kzg-4844 which currently patches blst to expose these functions. It would beneficial to us if these functions were exported. This PR only makes these functions available from C and not any of the other bindings. This is all we want/need at the moment.