Skip to content

Commit f3fe3af

Browse files
committed
[CODEC-276] Reliance on default encoding in MurmurHash2 and MurmurHash3.
Update Javadoc with fix from Alex Herbert.
1 parent 627b5fd commit f3fe3af

2 files changed

Lines changed: 16 additions & 4 deletions

File tree

src/main/java/org/apache/commons/codec/digest/MurmurHash2.java

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,10 @@ public static int hash32(final byte[] data, final int length) {
137137

138138
/**
139139
* Generates a 32-bit hash from a string with a default seed.
140-
* The string is converted to bytes using the default encoding.
140+
* <p>
141+
* Before 1.14 the string was converted using default encoding.
142+
* Since 1.14 the string is converted to bytes using UTF-8 encoding.
143+
* </p>
141144
* This is a helper method that will produce the same result as:
142145
*
143146
* <pre>
@@ -248,7 +251,10 @@ public static long hash64(final byte[] data, final int length) {
248251

249252
/**
250253
* Generates a 64-bit hash from a string with a default seed.
251-
* The string is converted to bytes using the default encoding.
254+
* <p>
255+
* Before 1.14 the string was converted using default encoding.
256+
* Since 1.14 the string is converted to bytes using UTF-8 encoding.
257+
* </p>
252258
* This is a helper method that will produce the same result as:
253259
*
254260
* <pre>

src/main/java/org/apache/commons/codec/digest/MurmurHash3.java

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,10 @@ public static int hash32(final byte[] data) {
237237

238238
/**
239239
* Generates 32-bit hash from a string with a default seed.
240-
* The string is converted to bytes using the default encoding.
240+
* <p>
241+
* Before 1.14 the string was converted using default encoding.
242+
* Since 1.14 the string is converted to bytes using UTF-8 encoding.
243+
* </p>
241244
* This is a helper method that will produce the same result as:
242245
*
243246
* <pre>
@@ -755,7 +758,10 @@ public static long[] hash128x64(final byte[] data) {
755758

756759
/**
757760
* Generates 128-bit hash from a string with a default seed.
758-
* The string is converted to bytes using the default encoding.
761+
* <p>
762+
* Before 1.14 the string was converted using default encoding.
763+
* Since 1.14 the string is converted to bytes using UTF-8 encoding.
764+
* </p>
759765
* This is a helper method that will produce the same result as:
760766
*
761767
* <pre>

0 commit comments

Comments
 (0)