Skip to content

Instantly share code, notes, and snippets.

@Renien
Created June 18, 2018 04:31
Show Gist options
  • Save Renien/a0e980eacf45152327ce4501065291ca to your computer and use it in GitHub Desktop.
Save Renien/a0e980eacf45152327ce4501065291ca to your computer and use it in GitHub Desktop.
Clarify the doubts about hasing function.
import scala.util.hashing.MurmurHash3
def md3(s: String) = {
MurmurHash3.stringHash(s).toString
}
val hasehd = List(md3("1"), md3("2"), md3("3"), md3("Product:12345"), md3("Product:12346"), md3("Product:12347"))
val unhashed = List("1", "2", "Product:12345", "Product:12346", "Product:12347", "3")
unhashed.sorted
hasehd.sorted
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment