From ca79b0c735a35988e4b16a926150bf6de02db5c8 Mon Sep 17 00:00:00 2001 From: ice_iix Date: Wed, 3 Oct 2018 18:28:05 -0700 Subject: [PATCH] Use the RustCrypto sha-1 crate instead of sha1 For https://github.com/iceiix/steven/issues/2#issuecomment-425769562 --- protocol/src/protocol/mojang.rs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/protocol/src/protocol/mojang.rs b/protocol/src/protocol/mojang.rs index edf0a91..f1506b6 100644 --- a/protocol/src/protocol/mojang.rs +++ b/protocol/src/protocol/mojang.rs @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -use sha1; +use sha1::{self, Digest}; use serde_json; use serde_json::builder::ObjectBuilder; use hyper; @@ -101,11 +101,11 @@ impl Profile { } pub fn join_server(&self, server_id: &str, shared_key: &[u8], public_key: &[u8]) -> Result<(), super::Error> { - let mut sha1 = sha1::Sha1::new(); - sha1.update(server_id.as_bytes()); - sha1.update(shared_key); - sha1.update(public_key); - let mut hash = sha1.digest().bytes(); + let mut hasher = sha1::Sha1::new(); + hasher.input(server_id.as_bytes()); + hasher.input(shared_key); + hasher.input(public_key); + let mut hash = hasher.result(); // Mojang uses a hex method which allows for // negatives so we have to account for that.