64bit (Long) hash of a string in Scala

1.1k Views Asked by At

I need a uniform string hash that produces longs, for use in a bloom filter. Where can I find an algorithm or a library for this? Thanks.

1

There are 1 best solutions below

2
Dima On BEST ANSWER

You can do what String.hashCode does, just using longs:

 val code = string.foldLeft(0L) { case (code, c) => 31*code + c }