You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by GitBox <gi...@apache.org> on 2019/07/10 15:00:38 UTC

[GitHub] [commons-codec] garydgregory commented on a change in pull request #22: CODEC-236: MurmurHash2 and MurmurHash3 implementations.

garydgregory commented on a change in pull request #22: CODEC-236: MurmurHash2 and MurmurHash3 implementations.
URL: https://github.com/apache/commons-codec/pull/22#discussion_r302111328
 
 

 ##########
 File path: src/main/java/org/apache/commons/codec/digest/MurmurHash3.java
 ##########
 @@ -0,0 +1,551 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.commons.codec.digest;
+
+/**
+ * MurmurHash3 yields a 32-bit or 128-bit value.
+ * 
+ * MurmurHash is a non-cryptographic hash function suitable for general
+ * hash-based lookup. The name comes from two basic operations, multiply (MU)
+ * and rotate (R), used in its inner loop. Unlike cryptographic hash functions,
+ * it is not specifically designed to be difficult to reverse by an adversary,
+ * making it unsuitable for cryptographic purposes.
+ * 
+ * 32-bit Java port of
+ * https://code.google.com/p/smhasher/source/browse/trunk/MurmurHash3.cpp#94
+ * 128-bit Java port of
+ * https://code.google.com/p/smhasher/source/browse/trunk/MurmurHash3.cpp#255
+ *
+ * This is a public domain code with no copyrights. From homepage of MurmurHash
+ * (https://code.google.com/p/smhasher/), "All MurmurHash versions are public
+ * domain software, and the author disclaims all copyright to their code."
+ * 
+ * Copied from Apache Hive:
+ * https://github.com/apache/hive/blob/master/storage-api/src/java/org/apache/hive/common/util/Murmur3.java
+ * 
+ * @see <a href="https://en.wikipedia.org/wiki/MurmurHash">MurmurHash</a>
+ * @since 1.13
+ */
+public final class MurmurHash3 {
 
 Review comment:
   NOT all methods should be static: You should implement Codec's `BinaryEncoder` and `BinaryDecoder` interfaces and/or `StringEncoder` and `StringDecoder` depending on the use cases of this code.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services