Skip to content

Commit 6f842a1

Browse files
ndmitchellfacebook-github-bot
authored andcommitted
Switch to Blake3 hashing
Summary: This is what Glean does. Reviewed By: kinto0 Differential Revision: D72962139 fbshipit-source-id: 9efd231d428c8617fb8ff65a5773088680540ae0
1 parent 611ae3a commit 6f842a1

File tree

2 files changed

+3
-7
lines changed

2 files changed

+3
-7
lines changed

pyrefly/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ anyhow = "1.0.95"
2121
append-only-vec = "0.1.2"
2222
argfile = "0.1.6"
2323
async-trait = "0.1.86"
24+
blake3 = { version = "=1.5.2", features = ["mmap", "rayon", "traits-preview"] }
2425
clap = { version = "4.5.30", features = ["derive", "env", "string", "unicode", "wrap_help"] }
2526
const-str = "0.4.3"
2627
convert_case = "0.6"

pyrefly/lib/report/glean/convert.rs

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,6 @@
55
* LICENSE file in the root directory of this source tree.
66
*/
77

8-
use std::hash::DefaultHasher;
9-
use std::hash::Hasher;
10-
118
use ruff_python_ast::ModModule;
129
use serde::Serialize;
1310
use serde_json::Value;
@@ -22,10 +19,8 @@ fn json(x: impl Serialize) -> Value {
2219
}
2320

2421
fn hash(x: &[u8]) -> String {
25-
// TODO: Use whatever hash algorithm Glean uses
26-
let mut hasher = DefaultHasher::new();
27-
hasher.write(x);
28-
hasher.finish().to_string()
22+
// Glean uses blake3
23+
blake3::hash(x).to_string()
2924
}
3025

3126
impl Glean {

0 commit comments

Comments
 (0)