Skip to content

Commit a601cb9

Browse files
authored
(161424331) Change Data hashing to full bytes (#1546)
1 parent 4273e23 commit a601cb9

File tree

1 file changed

+4
-8
lines changed

1 file changed

+4
-8
lines changed

Sources/FoundationEssentials/Data/Data.swift

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1087,10 +1087,8 @@ public struct Data : Equatable, Hashable, RandomAccessCollection, MutableCollect
10871087
func hash(into hasher: inout Hasher) {
10881088
hasher.combine(count)
10891089

1090-
// At most, hash the first 80 bytes of this data.
1091-
let range = startIndex ..< Swift.min(startIndex + 80, endIndex)
1092-
storage.withUnsafeBytes(in: range) {
1093-
hasher.combine(bytes: $0)
1090+
self.withUnsafeBytes { bytes in
1091+
hasher.combine(bytes: bytes)
10941092
}
10951093
}
10961094
}
@@ -1325,10 +1323,8 @@ public struct Data : Equatable, Hashable, RandomAccessCollection, MutableCollect
13251323
func hash(into hasher: inout Hasher) {
13261324
hasher.combine(count)
13271325

1328-
// Hash at most the first 80 bytes of this data.
1329-
let range = startIndex ..< Swift.min(startIndex + 80, endIndex)
1330-
storage.withUnsafeBytes(in: range) {
1331-
hasher.combine(bytes: $0)
1326+
self.withUnsafeBytes { bytes in
1327+
hasher.combine(bytes: bytes)
13321328
}
13331329
}
13341330
}

0 commit comments

Comments
 (0)