Skip to content

Commit 7ade136

Browse files
committed
[CODEC-268] Deprecate hash methods using String.getBytes()
A character encoding should be used to get the string bytes.
1 parent 9125e28 commit 7ade136

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

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

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -253,7 +253,8 @@ public static int hash32(final byte[] data) {
253253
* @param data The input string
254254
* @return The 32-bit hash
255255
* @see #hash32(byte[], int, int, int)
256-
* @deprecated Use {@link #hash32x86(byte[], int, int, int)} with the String byte data. This corrects the processing of trailing bytes.
256+
* @deprecated Use {@link #hash32x86(byte[], int, int, int)} with the bytes returned from
257+
* {@link String#getBytes(java.nio.charset.Charset)}. This corrects the processing of trailing bytes.
257258
*/
258259
@Deprecated
259260
public static int hash32(final String data) {
@@ -751,7 +752,10 @@ public static long[] hash128x64(final byte[] data) {
751752
* @param data The input String
752753
* @return The 128-bit hash (2 longs)
753754
* @see #hash128(byte[], int, int, int)
755+
* @deprecated Use {@link #hash128x64(byte[])} using the bytes returned from
756+
* {@link String#getBytes(java.nio.charset.Charset)}.
754757
*/
758+
@Deprecated
755759
public static long[] hash128(final String data) {
756760
final byte[] bytes = data.getBytes();
757761
return hash128(bytes, 0, bytes.length, DEFAULT_SEED);

0 commit comments

Comments
 (0)