It's probably possible to make it match Swift string hashing:
extension String: Hashable {
/// Hashes the essential components of this value by feeding them into the
/// given hasher.
///
/// - Parameter hasher: The hasher to use when combining the components
/// of this instance.
public func hash(into hasher: inout Hasher) {
if _fastPath(self._guts.isNFCFastUTF8) {
self._guts.withFastUTF8 {
hasher.combine(bytes: UnsafeRawBufferPointer($0))
}
hasher.combine(0xFF as UInt8) // terminator
} else {
_gutsSlice._normalizedHash(into: &hasher)
}
}
}
by using toUtf8Buffer, but I don't think there's an effective way to get actual byte array from PackedByteArray.
Closes #344, closes #379.
It's probably possible to make it match Swift string hashing:
by using
toUtf8Buffer
, but I don't think there's an effective way to get actual byte array fromPackedByteArray
.