2019-08-17 20:31:41 +03:00

13 lines
287 B
Swift

import Foundation
public extension String {
var persistentHashValue: UInt64 {
var result = UInt64 (5381)
let buf = [UInt8](self.utf8)
for b in buf {
result = 127 * (result & 0x00ffffffffffffff) + UInt64(b)
}
return result
}
}