• R/O
  • HTTP
  • SSH
  • HTTPS

Tags
No Tags

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

blake3パッケージ


File Info

Rev. f161c99ddbfa9dc2a807330125ca3161ff3a7238
Size 2,731 bytes
Time 2020-05-29 06:11:54
Author dyknon
Log Message

update depending crate + release

Content

From: dyknon <dyknon@users.osdn.me>
Date: Sat, 4 Apr 2020 04:42:57 +0900
Subject: change depending crate versions

---
 Cargo.toml       | 4 ++--
 b3sum/Cargo.toml | 4 ++--
 src/lib.rs       | 8 ++++++--
 src/traits.rs    | 3 ++-
 4 files changed, 12 insertions(+), 7 deletions(-)

diff --git a/Cargo.toml b/Cargo.toml
index 0d77fc8..ed69efd 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -72,10 +72,10 @@ features = ["rayon"]
 [dependencies]
 arrayref = "0.3.5"
 arrayvec = { version = "0.5.1", default-features = false, features = ["array-sizes-33-128"] }
-constant_time_eq = "0.1.5"
+constant_time_eq = "0.1.4"
 rayon = { version = "1.2.1", optional = true }
 cfg-if = "0.1.10"
-digest = "0.8.1"
+digest = "0.8.0"
 crypto-mac = "0.7.0"
 
 [dev-dependencies]
diff --git a/b3sum/Cargo.toml b/b3sum/Cargo.toml
index 56ed381..151648a 100644
--- a/b3sum/Cargo.toml
+++ b/b3sum/Cargo.toml
@@ -16,11 +16,11 @@ pure = ["blake3/pure"]
 [dependencies]
 anyhow = "1.0.25"
 blake3 = { version = "0.3", path = "..", features = ["rayon"] }
-clap = "2.33.1"
+clap = "2.33"
 hex = "0.4.0"
 memmap = "0.7.0"
 rayon = "1.2.1"
-wild = "2.0.3"
+wild = "2.0.2"
 
 [dev-dependencies]
 duct = "0.13.3"
diff --git a/src/lib.rs b/src/lib.rs
index e9480e8..25e2f80 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -161,6 +161,10 @@ fn counter_high(counter: u64) -> u32 {
     (counter >> 32) as u32
 }
 
+fn constant_time_eq_32(a: &[u8; 32], b: &[u8; 32]) -> bool {
+    constant_time_eq::constant_time_eq(a, b)
+}
+
 /// An output of the default size, 32 bytes, which provides constant-time
 /// equality checking.
 ///
@@ -242,7 +246,7 @@ impl From<Hash> for [u8; OUT_LEN] {
 impl PartialEq for Hash {
     #[inline]
     fn eq(&self, other: &Hash) -> bool {
-        constant_time_eq::constant_time_eq_32(&self.0, &other.0)
+        constant_time_eq_32(&self.0, &other.0)
     }
 }
 
@@ -250,7 +254,7 @@ impl PartialEq for Hash {
 impl PartialEq<[u8; OUT_LEN]> for Hash {
     #[inline]
     fn eq(&self, other: &[u8; OUT_LEN]) -> bool {
-        constant_time_eq::constant_time_eq_32(&self.0, other)
+        constant_time_eq_32(&self.0, other)
     }
 }
 
diff --git a/src/traits.rs b/src/traits.rs
index c4fff98..e2d26f3 100644
--- a/src/traits.rs
+++ b/src/traits.rs
@@ -10,6 +10,7 @@ use digest::generic_array::{
     typenum::{U32, U64},
     GenericArray,
 };
+use std::convert::TryInto;
 
 impl digest::BlockInput for Hasher {
     type BlockSize = U64;
@@ -60,7 +61,7 @@ impl crypto_mac::Mac for Hasher {
 
     #[inline]
     fn new(key: &GenericArray<u8, Self::KeySize>) -> Self {
-        let key_bytes: [u8; 32] = (*key).into();
+        let key_bytes: [u8; 32] = key.as_ref().try_into().unwrap();
         Hasher::new_keyed(&key_bytes)
     }