From 6afd8ff212694669973043e4277f0938cebff24a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Garillot?= Date: Mon, 15 Jun 2020 07:14:45 -0400 Subject: [PATCH] Update sha2, digest to 0.9 --- Cargo.toml | 4 ++-- src/ristretto.rs | 4 ++-- src/scalar.rs | 8 ++++---- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index d73a932..d4fa2f0 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -30,7 +30,7 @@ features = ["nightly", "simd_backend"] travis-ci = { repository = "dalek-cryptography/curve25519-dalek", branch = "master"} [dev-dependencies] -sha2 = { version = "0.8", default-features = false } +sha2 = { version = "0.9", default-features = false } bincode = "1" criterion = "0.3.0" rand = "0.7" @@ -42,7 +42,7 @@ harness = false [dependencies] rand_core = { version = "0.5", default-features = false } byteorder = { version = "^1.2.3", default-features = false, features = ["i128"] } -digest = { version = "0.8", default-features = false } +digest = { version = "0.9", default-features = false } subtle = { version = "^2.2.1", default-features = false } serde = { version = "1.0", default-features = false, optional = true, features = ["derive"] } packed_simd = { version = "0.3", features = ["into_bits"], optional = true } diff --git a/src/ristretto.rs b/src/ristretto.rs index 977f52f..93d310f 100644 --- a/src/ristretto.rs +++ b/src/ristretto.rs @@ -689,7 +689,7 @@ impl RistrettoPoint { where D: Digest + Default { let mut hash = D::default(); - hash.input(input); + hash.update(input); RistrettoPoint::from_hash(hash) } @@ -702,7 +702,7 @@ impl RistrettoPoint { where D: Digest + Default { // dealing with generic arrays is clumsy, until const generics land - let output = hash.result(); + let output = hash.finalize(); let mut output_bytes = [0u8; 64]; output_bytes.copy_from_slice(&output.as_slice()); diff --git a/src/scalar.rs b/src/scalar.rs index 87f5da9..6ead65a 100644 --- a/src/scalar.rs +++ b/src/scalar.rs @@ -102,8 +102,8 @@ //! //! // Streaming data into a hash object //! let mut hasher = Sha512::default(); -//! hasher.input(b"Abolish "); -//! hasher.input(b"ICE"); +//! hasher.update(b"Abolish "); +//! hasher.update(b"ICE"); //! let a2 = Scalar::from_hash(hasher); //! //! assert_eq!(a, a2); @@ -588,7 +588,7 @@ impl Scalar { where D: Digest + Default { let mut hash = D::default(); - hash.input(input); + hash.update(input); Scalar::from_hash(hash) } @@ -630,7 +630,7 @@ impl Scalar { where D: Digest { let mut output = [0u8; 64]; - output.copy_from_slice(hash.result().as_slice()); + output.copy_from_slice(hash.finalize().as_slice()); Scalar::from_bytes_mod_order_wide(&output) }