Skip to content

Commit 19aaeb3

Browse files
authored
Remove sample based image hashing to avoid false equalities (#3980)
* Remove sample based image hashing to avoid false equalities This was originally introduced to improve the performance of working with image data, but since the memo hash wrapper got introduced this should no longer be really necessary. * Fix todo comment
1 parent bf269d7 commit 19aaeb3

File tree

1 file changed

+1
-7
lines changed
  • node-graph/libraries/raster-types/src

1 file changed

+1
-7
lines changed

node-graph/libraries/raster-types/src/image.rs

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -109,17 +109,11 @@ impl<P: Copy + Pixel> BitmapMut for Image<P> {
109109
}
110110
}
111111

112-
// TODO: Evaluate if this will be a problem for our use case.
113-
/// Warning: This is an approximation of a hash, and is not guaranteed to not collide.
114112
impl<P: Hash + Pixel> Hash for Image<P> {
115113
fn hash<H: Hasher>(&self, state: &mut H) {
116-
const HASH_SAMPLES: u64 = 1000;
117-
let data_length = self.data.len() as u64;
118114
self.width.hash(state);
119115
self.height.hash(state);
120-
for i in 0..HASH_SAMPLES.min(data_length) {
121-
self.data[(i * data_length / HASH_SAMPLES) as usize].hash(state);
122-
}
116+
self.data.hash(state);
123117
}
124118
}
125119

0 commit comments

Comments
 (0)