I'm not really that strong in cryptography, so I'm striving to understand what this Java code exactly does:
MessageDigest md = MessageDigest.getInstance("SHA-256");
md.update("some string".getBytes("UTF-8"));
byte[] digest = md.digest();
and convert it to Rust.
So how can I do the same thing in Rust, what traits should I use? Is it http://doc.rust-lang.org/rustc/util/sha2/struct.Sha256.html or something else?
rustc::util::sha2::Sha256
is part of the Rust compiler and is not meant for external use. You should use the rust-crypto crate instead. Itssha2
module implements SHA-256.