From 5f793bfdba81e3c971ff8e5062362176ebcfe73b Mon Sep 17 00:00:00 2001 From: Jeremy Schonfeld Date: Fri, 26 Sep 2025 13:21:30 -0700 Subject: [PATCH] (161424331) Change Data hashing to full bytes --- Sources/FoundationEssentials/Data/Data.swift | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/Sources/FoundationEssentials/Data/Data.swift b/Sources/FoundationEssentials/Data/Data.swift index 462d03b3c..b0fa71c28 100644 --- a/Sources/FoundationEssentials/Data/Data.swift +++ b/Sources/FoundationEssentials/Data/Data.swift @@ -1087,10 +1087,8 @@ public struct Data : Equatable, Hashable, RandomAccessCollection, MutableCollect func hash(into hasher: inout Hasher) { hasher.combine(count) - // At most, hash the first 80 bytes of this data. - let range = startIndex ..< Swift.min(startIndex + 80, endIndex) - storage.withUnsafeBytes(in: range) { - hasher.combine(bytes: $0) + self.withUnsafeBytes { bytes in + hasher.combine(bytes: bytes) } } } @@ -1325,10 +1323,8 @@ public struct Data : Equatable, Hashable, RandomAccessCollection, MutableCollect func hash(into hasher: inout Hasher) { hasher.combine(count) - // Hash at most the first 80 bytes of this data. - let range = startIndex ..< Swift.min(startIndex + 80, endIndex) - storage.withUnsafeBytes(in: range) { - hasher.combine(bytes: $0) + self.withUnsafeBytes { bytes in + hasher.combine(bytes: bytes) } } }