Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 10 additions & 16 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ self-replace = { version = "1.5.0" }
serde = { version = "1.0.210", features = ["derive", "rc"] }
serde-untagged = { version = "0.1.6" }
serde_json = { version = "1.0.128" }
sha2 = { version = "0.10.8" }
sha2 = { version = "0.11.0" }
smallvec = { version = "1.13.2" }
spdx = { version = "0.13.0" }
syn = { version = "3.0.0" }
Expand Down
1 change: 1 addition & 0 deletions crates/uv-build-backend/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ schemars = ["dep:schemars", "uv-pypi-types/schemars"]
uv-preview = { workspace = true, features = ["testing"] }

anstream = { workspace = true }
hex = { workspace = true }
indoc = { workspace = true }
insta = { workspace = true }
regex = { workspace = true }
4 changes: 2 additions & 2 deletions crates/uv-build-backend/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -787,7 +787,7 @@ mod tests {
);
// Check that the source dist is reproducible across platforms.
assert_snapshot!(
format!("{:x}", sha2::Sha256::digest(fs_err::read(&source_dist_path).unwrap())),
hex::encode(sha2::Sha256::digest(fs_err::read(&source_dist_path).unwrap())),
@"1d9ce1ce63195fbee07314c0b595ba9e063670da8d10c252c351b21e94e3f508"
);
// Check both the files we report and the actual files
Expand Down Expand Up @@ -843,7 +843,7 @@ mod tests {
);
// Check that the wheel is reproducible across platforms.
assert_snapshot!(
format!("{:x}", sha2::Sha256::digest(fs_err::read(&wheel_path).unwrap())),
hex::encode(sha2::Sha256::digest(fs_err::read(&wheel_path).unwrap())),
@"9e8d80fef76be79a7fe73a2ccac3bdd0132b10fdcff7271ca8b868c99061b8ce"
);
assert_snapshot!(build.wheel_contents.join("\n"), @"
Expand Down
4 changes: 1 addition & 3 deletions crates/uv-extract/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ blake2 = { workspace = true }
flate2 = { workspace = true }
fs-err = { workspace = true, features = ["tokio"] }
futures = { workspace = true }
hex = { workspace = true }
md-5 = { workspace = true }
rayon = { workspace = true }
regex = { workspace = true }
Expand All @@ -39,9 +40,6 @@ tokio = { workspace = true }
tokio-util = { workspace = true, features = ["compat"] }
tracing = { workspace = true }

[target.'cfg(all(target_arch = "aarch64", not(target_os = "windows")))'.dependencies]
sha2 = { workspace = true, features = ["asm"] }

[features]
default = []

Expand Down
13 changes: 7 additions & 6 deletions crates/uv-extract/src/hash.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
use blake2::digest::consts::U32;
// MD5 and BLAKE2 still use the `digest` 0.10 trait, while SHA-2 uses 0.11.
use blake2::digest::{Digest as _, consts::U32};
use sha2::Digest;
use std::pin::Pin;
use std::task::{Context, Poll};
Expand Down Expand Up @@ -44,23 +45,23 @@ impl From<Hasher> for HashDigest {
match hasher {
Hasher::Md5(hasher) => Self {
algorithm: HashAlgorithm::Md5,
digest: format!("{:x}", hasher.finalize()).into(),
digest: hex::encode(hasher.finalize()).into(),
},
Hasher::Sha256(hasher) => Self {
algorithm: HashAlgorithm::Sha256,
digest: format!("{:x}", hasher.finalize()).into(),
digest: hex::encode(hasher.finalize()).into(),
},
Hasher::Sha384(hasher) => Self {
algorithm: HashAlgorithm::Sha384,
digest: format!("{:x}", hasher.finalize()).into(),
digest: hex::encode(hasher.finalize()).into(),
},
Hasher::Sha512(hasher) => Self {
algorithm: HashAlgorithm::Sha512,
digest: format!("{:x}", hasher.finalize()).into(),
digest: hex::encode(hasher.finalize()).into(),
},
Hasher::Blake2b(hasher) => Self {
algorithm: HashAlgorithm::Blake2b,
digest: format!("{:x}", hasher.finalize()).into(),
digest: hex::encode(hasher.finalize()).into(),
},
}
}
Expand Down
1 change: 1 addition & 0 deletions crates/uv-test/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ base64 = { workspace = true }
flate2 = { workspace = true }
fs-err = { workspace = true, features = ["tokio"] }
futures = { workspace = true }
hex = { workspace = true }
http = { workspace = true }
ignore = { workspace = true }
indoc = { workspace = true }
Expand Down
2 changes: 1 addition & 1 deletion crates/uv-test/src/packse/wheel.rs
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ where
pub fn sha256_hex(data: &[u8]) -> String {
let mut hasher = Sha256::new();
hasher.update(data);
format!("{:x}", hasher.finalize())
hex::encode(hasher.finalize())
}

#[cfg(test)]
Expand Down
2 changes: 1 addition & 1 deletion crates/uv-test/src/vendor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@ fn artifact_lock_path(path: &Path) -> Result<PathBuf> {
}

fn verify_bytes(artifact: &VendorArtifact, bytes: &[u8]) -> Result<()> {
let actual = format!("{:x}", Sha256::digest(bytes));
let actual = hex::encode(Sha256::digest(bytes));
if actual == artifact.sha256 {
Ok(())
} else {
Expand Down
1 change: 1 addition & 0 deletions crates/uv/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,7 @@ byteorder = { workspace = true }
bytes = { workspace = true }
filetime = { workspace = true }
flate2 = { workspace = true, default-features = false }
hex = { workspace = true }
http-body-util = { workspace = true }
hyper = { workspace = true }
hyper-util = { workspace = true }
Expand Down
2 changes: 1 addition & 1 deletion crates/uv/tests/it/publish.rs
Original file line number Diff line number Diff line change
Expand Up @@ -467,7 +467,7 @@ async fn read_index_credential_env_vars_for_check_url() {

let filename = "astral_test_private-0.1.0-py3-none-any.whl";
let wheel = context.temp_dir.join("dist").join(filename);
let sha256 = format!("{:x}", Sha256::digest(fs_err::read(&wheel).unwrap()));
let sha256 = hex::encode(Sha256::digest(fs_err::read(&wheel).unwrap()));

let simple_index = json! ({
"files": [
Expand Down
Loading