diff --git a/scavenger-model/build.gradle.kts b/scavenger-model/build.gradle.kts index 33eef45..b040a3b 100644 --- a/scavenger-model/build.gradle.kts +++ b/scavenger-model/build.gradle.kts @@ -1,4 +1,9 @@ -import com.google.protobuf.gradle.* +import com.google.protobuf.gradle.builtins +import com.google.protobuf.gradle.generateProtoTasks +import com.google.protobuf.gradle.id +import com.google.protobuf.gradle.plugins +import com.google.protobuf.gradle.protobuf +import com.google.protobuf.gradle.protoc plugins { java @@ -17,6 +22,7 @@ dependencies { implementation("io.grpc:grpc-kotlin-stub:${property("grpcKotlinVersion")}") implementation("io.grpc:grpc-protobuf:${property("grpcVersion")}") implementation("javax.annotation:javax.annotation-api:1.3.2") + implementation("commons-codec:commons-codec:1.17.1") } kotlin { diff --git a/scavenger-model/src/main/java/com/navercorp/scavenger/util/HashGenerator.java b/scavenger-model/src/main/java/com/navercorp/scavenger/util/HashGenerator.java index 5c01d23..f09c1cb 100644 --- a/scavenger-model/src/main/java/com/navercorp/scavenger/util/HashGenerator.java +++ b/scavenger-model/src/main/java/com/navercorp/scavenger/util/HashGenerator.java @@ -1,5 +1,7 @@ package com.navercorp.scavenger.util; +import org.apache.commons.codec.digest.MurmurHash3; + import java.math.BigInteger; import java.nio.charset.StandardCharsets; import java.security.MessageDigest; @@ -9,7 +11,14 @@ public class HashGenerator { public static class DefaultHash { public static String from(String signature) { - return Md5.from(signature); + return Murmur.from(signature); + } + } + + private static class Murmur { + private static String from(String signature) { + long[] x64hash = MurmurHash3.hash128x64(signature.getBytes(StandardCharsets.UTF_8)); + return Long.toHexString(x64hash[0]) + Long.toHexString(x64hash[1]); } }