YANDEX interview question

Write your own generic hash function in Swift