【发布时间】:2013-12-19 20:04:42
【问题描述】:
我没想到 NSString 上的哈希会根据目标设备返回不同的结果。
NSLog(@"%lu", (unsigned long)[@"test" hash]);
// 38178019076 on my iPad.
// 3818280708 on my iPhone and (iPhone/iPad-)Simulator.
除了应该小心使用 NSString 上的哈希 (hash is bad with NSString) 并且使用真正的哈希 (例如 sha) 可以轻松解决这个问题之外,我很感兴趣为什么会返回不同的结果?
【问题讨论】:
-
也许你有一个 32 位 iPad 和一个 64 位模拟器 (=Mac)...?
标签: ios objective-c hash nsstring