Data only calculates hashValue on first 80 bytes
| Originator: | peter | ||
| Number: | rdar://30830682 | Date Originated: | March 3 2017, 2:39 PM |
| Status: | open | Resolved: | |
| Product: | iOS + SDK | Product Version: | |
| Classification: | Reproducible: | yes |
Area: Foundation Summary: import Foundation let eightyBytes: [UInt8] = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9] let data1 = Data(bytes: eightyBytes + [0]) let data2 = Data(bytes: eightyBytes + [1]) assert(data1.hashValue != data2.hashValue) Steps to Reproduce: Run the above code. Expected Results: Hash value should be different. Actual Results: Hash value is identical. Version: Xcode 8.2 (8C38) Simulator Notes: We read SVG files as Data and set as properties in structs we need to implement Hashable on. Too often they are identical in the first 80+ bytes. Configuration: Simulator running iOS
Comments
Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!