| 1 |
/* |
| 2 |
* Licensed under the Apache License, Version 2.0 (the "License"); |
| 3 |
* you may not use this file except in compliance with the License. |
| 4 |
* You may obtain a copy of the License at |
| 5 |
* |
| 6 |
* http://www.apache.org/licenses/LICENSE-2.0 |
| 7 |
* |
| 8 |
* Unless required by applicable law or agreed to in writing, software |
| 9 |
* distributed under the License is distributed on an "AS IS" BASIS, |
| 10 |
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 11 |
* See the License for the specific language governing permissions and |
| 12 |
* limitations under the License. |
| 13 |
*/ |
| 14 |
package io.airlift.slice; |
| 15 |
|
| 16 |
@Deprecated |
| 17 |
public class Murmur3 |
| 18 |
{ |
| 19 |
public static Slice hash(Slice data) |
| 20 |
{ |
| 21 |
return Murmur3Hash128.hash(data); |
| 22 |
} |
| 23 |
|
| 24 |
public static Slice hash(Slice data, int offset, int length) |
| 25 |
{ |
| 26 |
return Murmur3Hash128.hash(data, offset, length); |
| 27 |
} |
| 28 |
|
| 29 |
public static Slice hash(long seed, Slice data, int offset, int length) |
| 30 |
{ |
| 31 |
return Murmur3Hash128.hash(seed, data, offset, length); |
| 32 |
} |
| 33 |
|
| 34 |
/** |
| 35 |
* Returns the 64 most significant bits of the Murmur128 hash of the provided value |
| 36 |
*/ |
| 37 |
public static long hash64(Slice data) |
| 38 |
{ |
| 39 |
return Murmur3Hash128.hash64(data); |
| 40 |
} |
| 41 |
|
| 42 |
public static long hash64(Slice data, int offset, int length) |
| 43 |
{ |
| 44 |
return Murmur3Hash128.hash64(data, offset, length); |
| 45 |
} |
| 46 |
|
| 47 |
public static long hash64(long seed, Slice data, int offset, int length) |
| 48 |
{ |
| 49 |
return Murmur3Hash128.hash64(seed, data, offset, length); |
| 50 |
} |
| 51 |
|
| 52 |
/** |
| 53 |
* Special-purpose version for hashing a single long value. Value is treated as little-endian |
| 54 |
*/ |
| 55 |
public static long hash64(long value) |
| 56 |
{ |
| 57 |
return Murmur3Hash128.hash64(value); |
| 58 |
} |
| 59 |
} |