You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by ah...@apache.org on 2019/12/03 11:38:24 UTC

[commons-codec] 04/07: [CODEC-268] Deprecate hash methods using String.getBytes()

This is an automated email from the ASF dual-hosted git repository.

aherbert pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-codec.git

commit 7ade1367c6856043b2bea455c3dbe96fb78e2813
Author: aherbert <ah...@apache.org>
AuthorDate: Tue Dec 3 11:24:59 2019 +0000

    [CODEC-268] Deprecate hash methods using String.getBytes()
    
    A character encoding should be used to get the string bytes.
---
 src/main/java/org/apache/commons/codec/digest/MurmurHash3.java | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/src/main/java/org/apache/commons/codec/digest/MurmurHash3.java b/src/main/java/org/apache/commons/codec/digest/MurmurHash3.java
index d4876d3..f4b9cca 100644
--- a/src/main/java/org/apache/commons/codec/digest/MurmurHash3.java
+++ b/src/main/java/org/apache/commons/codec/digest/MurmurHash3.java
@@ -253,7 +253,8 @@ public final class MurmurHash3 {
      * @param data The input string
      * @return The 32-bit hash
      * @see #hash32(byte[], int, int, int)
-     * @deprecated Use {@link #hash32x86(byte[], int, int, int)} with the String byte data. This corrects the processing of trailing bytes.
+     * @deprecated Use {@link #hash32x86(byte[], int, int, int)} with the bytes returned from
+     * {@link String#getBytes(java.nio.charset.Charset)}. This corrects the processing of trailing bytes.
      */
     @Deprecated
     public static int hash32(final String data) {
@@ -751,7 +752,10 @@ public final class MurmurHash3 {
      * @param data The input String
      * @return The 128-bit hash (2 longs)
      * @see #hash128(byte[], int, int, int)
+     * @deprecated Use {@link #hash128x64(byte[])} using the bytes returned from
+     * {@link String#getBytes(java.nio.charset.Charset)}.
      */
+    @Deprecated
     public static long[] hash128(final String data) {
         final byte[] bytes = data.getBytes();
         return hash128(bytes, 0, bytes.length, DEFAULT_SEED);