For example, rust-crypto.
Emacs has its own SHA256 implementation, which we don't need.
What about using ring? It's becoming the preferred Rust crypto library from what I can see.
Thanks, I've updated the issue to be less explicit about which library we use.
I'd like to claim this, since I'm learning ring.
@moosingin3space it's yours! :)
Have a look at Fbase64_encode_string for an example of creating strings in Rust. The elisp functions exposing this functionality are md5 and secure-hash, which live in src/fns.c.
Alternatively, you don't need to redefined the elisp functions. You could look at the secure_hash C function in src/fns.c, which chooses a hash_func value like sha256_buffer (defined in lib/sha256.c). You'd then need to expose a function in lib.rs with the same calling convention:
sha256_buffer (const char *buffer, size_t len, void *resblock);