kotlinx-murmurhash
kotlinx-murmurhash copied to clipboard
Kotlin Multiplatform (KMP) library for hashing using MurmurHash
kotlinx-murmurhash
Kotlin Multiplatform (KMP) library for MurmurHash, a non-cryptographic hash function for general hash-based lookup focused on simplicity and performance.
Usage
Add the dependency in build.gradle.kts:
kotlin {
sourceSets {
val commonMain by getting {
dependencies {
implementation("com.goncalossilva:murmurhash:<version>")
}
}
}
}
Use the provided MurmurHash* classes and hash* hashing functions.
Example
MurmurHash3().hash32x86(string.encodeToByteArray())
Contributing
Pull requests are welcome! See MurmurHash3Test for an example of how to leverage hashes computed by the canonical C++ implementation for testing.
Feel free to contribute earlier versions, such as MurmurHash2 and MurmurHash1.
Acknowledgements
Testing using a wordlist and pre-computed hashes of the canonical C++ implementation is inspired by @sangupta's murmur Java implementation.
License
Released under the MIT License.