From c820db2818eb36af656e0d5324e2b5c14b035092 Mon Sep 17 00:00:00 2001 From: Jefffrey Date: Sat, 25 Apr 2026 16:15:36 +0900 Subject: [PATCH 1/2] chore: bump `sha` & `md-5` to `0.11.0` --- Cargo.lock | 21 +++------- Cargo.toml | 2 +- datafusion/functions/Cargo.toml | 4 +- datafusion/functions/src/crypto/basic.rs | 52 +++++++++++++----------- 4 files changed, 36 insertions(+), 43 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 5a76c063bbfad..96c2e5067f69f 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -773,7 +773,7 @@ dependencies = [ "http 0.2.12", "http 1.4.0", "percent-encoding", - "sha2 0.11.0", + "sha2", "time", "tracing", ] @@ -2283,12 +2283,12 @@ dependencies = [ "hex", "itertools 0.14.0", "log", - "md-5 0.10.6", + "md-5 0.11.0", "memchr", "num-traits", "rand 0.9.4", "regex", - "sha2 0.10.9", + "sha2", "tokio", "uuid", ] @@ -2639,7 +2639,7 @@ dependencies = [ "rand 0.9.4", "serde_json", "sha1 0.11.0", - "sha2 0.10.9", + "sha2", "url", ] @@ -4756,7 +4756,7 @@ dependencies = [ "md-5 0.11.0", "memchr", "rand 0.10.1", - "sha2 0.11.0", + "sha2", "stringprep", ] @@ -5710,17 +5710,6 @@ dependencies = [ "digest 0.11.2", ] -[[package]] -name = "sha2" -version = "0.10.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a7507d819769d01a365ab707794a4084392c824f54a7a6a7862f8c3d0892b283" -dependencies = [ - "cfg-if", - "cpufeatures 0.2.17", - "digest 0.10.7", -] - [[package]] name = "sha2" version = "0.11.0" diff --git a/Cargo.toml b/Cargo.toml index 82081c1e42930..0c768199c9498 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -190,7 +190,7 @@ recursive = "0.1.1" regex = "1.12" rstest = "0.26.1" serde_json = "1" -sha2 = "^0.10.9" +sha2 = "^0.11.0" sqlparser = { version = "0.61.0", default-features = false, features = ["std", "visitor"] } strum = "0.28.0" strum_macros = "0.28.0" diff --git a/datafusion/functions/Cargo.toml b/datafusion/functions/Cargo.toml index 967b35d2eb985..ab49f92a7daf1 100644 --- a/datafusion/functions/Cargo.toml +++ b/datafusion/functions/Cargo.toml @@ -68,7 +68,7 @@ name = "datafusion_functions" arrow = { workspace = true } arrow-buffer = { workspace = true } base64 = { version = "0.22", optional = true } -blake2 = { version = "^0.10.2", optional = true } +blake2 = { version = "^0.10.6", optional = true } blake3 = { version = "1.8", optional = true } chrono = { workspace = true } chrono-tz = { version = "0.10.4", optional = true } @@ -81,7 +81,7 @@ datafusion-macros = { workspace = true } hex = { workspace = true, optional = true } itertools = { workspace = true } log = { workspace = true } -md-5 = { version = "^0.10.0", optional = true } +md-5 = { version = "^0.11.0", optional = true } memchr = { workspace = true } num-traits = { workspace = true } rand = { workspace = true } diff --git a/datafusion/functions/src/crypto/basic.rs b/datafusion/functions/src/crypto/basic.rs index abb86b8246fc9..e848daaed1cbf 100644 --- a/datafusion/functions/src/crypto/basic.rs +++ b/datafusion/functions/src/crypto/basic.rs @@ -19,7 +19,7 @@ use arrow::array::{Array, ArrayRef, AsArray, BinaryArray, BinaryArrayType}; use arrow::datatypes::DataType; -use blake2::{Blake2b512, Blake2s256, Digest}; +use blake2::{Blake2b512, Blake2s256}; use blake3::Hasher as Blake3; use arrow::compute::StringArrayType; @@ -85,7 +85,8 @@ impl fmt::Display for DigestAlgorithm { } macro_rules! digest_to_array { - ($METHOD:ident, $INPUT:expr) => {{ + ($MODULE:ident, $METHOD:ident, $INPUT:expr) => {{ + use $MODULE::Digest; let binary_array: BinaryArray = $INPUT .iter() .map(|x| x.map(|x| $METHOD::digest(x))) @@ -95,20 +96,23 @@ macro_rules! digest_to_array { } macro_rules! digest_to_scalar { - ($METHOD: ident, $INPUT:expr) => {{ ScalarValue::Binary($INPUT.map(|v| $METHOD::digest(v).as_slice().to_vec())) }}; + ($MODULE: ident, $METHOD: ident, $INPUT:expr) => {{ + use $MODULE::Digest; + ScalarValue::Binary($INPUT.map(|v| $METHOD::digest(v).as_slice().to_vec())) + }}; } impl DigestAlgorithm { /// digest an optional string to its hash value, null values are returned as is fn digest_scalar(self, value: Option<&[u8]>) -> ColumnarValue { ColumnarValue::Scalar(match self { - Self::Md5 => digest_to_scalar!(Md5, value), - Self::Sha224 => digest_to_scalar!(Sha224, value), - Self::Sha256 => digest_to_scalar!(Sha256, value), - Self::Sha384 => digest_to_scalar!(Sha384, value), - Self::Sha512 => digest_to_scalar!(Sha512, value), - Self::Blake2b => digest_to_scalar!(Blake2b512, value), - Self::Blake2s => digest_to_scalar!(Blake2s256, value), + Self::Md5 => digest_to_scalar!(md5, Md5, value), + Self::Sha224 => digest_to_scalar!(sha2, Sha224, value), + Self::Sha256 => digest_to_scalar!(sha2, Sha256, value), + Self::Sha384 => digest_to_scalar!(sha2, Sha384, value), + Self::Sha512 => digest_to_scalar!(sha2, Sha512, value), + Self::Blake2b => digest_to_scalar!(blake2, Blake2b512, value), + Self::Blake2s => digest_to_scalar!(blake2, Blake2s256, value), Self::Blake3 => ScalarValue::Binary(value.map(|v| { let mut digest = Blake3::default(); digest.update(v); @@ -125,13 +129,13 @@ impl DigestAlgorithm { StringArrType: StringArrayType<'a>, { match self { - Self::Md5 => digest_to_array!(Md5, input_value), - Self::Sha224 => digest_to_array!(Sha224, input_value), - Self::Sha256 => digest_to_array!(Sha256, input_value), - Self::Sha384 => digest_to_array!(Sha384, input_value), - Self::Sha512 => digest_to_array!(Sha512, input_value), - Self::Blake2b => digest_to_array!(Blake2b512, input_value), - Self::Blake2s => digest_to_array!(Blake2s256, input_value), + Self::Md5 => digest_to_array!(md5, Md5, input_value), + Self::Sha224 => digest_to_array!(sha2, Sha224, input_value), + Self::Sha256 => digest_to_array!(sha2, Sha256, input_value), + Self::Sha384 => digest_to_array!(sha2, Sha384, input_value), + Self::Sha512 => digest_to_array!(sha2, Sha512, input_value), + Self::Blake2b => digest_to_array!(blake2, Blake2b512, input_value), + Self::Blake2s => digest_to_array!(blake2, Blake2s256, input_value), Self::Blake3 => { let binary_array: BinaryArray = input_value .iter() @@ -156,13 +160,13 @@ impl DigestAlgorithm { BinaryArrType: BinaryArrayType<'a>, { match self { - Self::Md5 => digest_to_array!(Md5, input_value), - Self::Sha224 => digest_to_array!(Sha224, input_value), - Self::Sha256 => digest_to_array!(Sha256, input_value), - Self::Sha384 => digest_to_array!(Sha384, input_value), - Self::Sha512 => digest_to_array!(Sha512, input_value), - Self::Blake2b => digest_to_array!(Blake2b512, input_value), - Self::Blake2s => digest_to_array!(Blake2s256, input_value), + Self::Md5 => digest_to_array!(md5, Md5, input_value), + Self::Sha224 => digest_to_array!(sha2, Sha224, input_value), + Self::Sha256 => digest_to_array!(sha2, Sha256, input_value), + Self::Sha384 => digest_to_array!(sha2, Sha384, input_value), + Self::Sha512 => digest_to_array!(sha2, Sha512, input_value), + Self::Blake2b => digest_to_array!(blake2, Blake2b512, input_value), + Self::Blake2s => digest_to_array!(blake2, Blake2s256, input_value), Self::Blake3 => { let binary_array: BinaryArray = input_value .iter() From 4ef60d93e25932d920b4be7a944bcd265ad78400 Mon Sep 17 00:00:00 2001 From: Jefffrey Date: Sat, 25 Apr 2026 16:18:50 +0900 Subject: [PATCH 2/2] revert blake2 bump --- datafusion/functions/Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/datafusion/functions/Cargo.toml b/datafusion/functions/Cargo.toml index ab49f92a7daf1..410eb3c968c01 100644 --- a/datafusion/functions/Cargo.toml +++ b/datafusion/functions/Cargo.toml @@ -68,7 +68,7 @@ name = "datafusion_functions" arrow = { workspace = true } arrow-buffer = { workspace = true } base64 = { version = "0.22", optional = true } -blake2 = { version = "^0.10.6", optional = true } +blake2 = { version = "^0.10.2", optional = true } blake3 = { version = "1.8", optional = true } chrono = { workspace = true } chrono-tz = { version = "0.10.4", optional = true }