Release ObjectStore 0.0.8

This commit is contained in:
admin committed 2026-10-10 15:22:21 +02:00
1 parent ed7712a8af
commit d6427fbac9
61 files changed
+7082 -267

No files matched your search

+32
View File
@@ -0,0 +1,32 @@
package cloud.lunarsky.store;
import com.dynatrace.hash4j.hashing.HashStream64;
import com.dynatrace.hash4j.hashing.HashStream128;
import com.dynatrace.hash4j.hashing.Hashing;
import java.nio.ByteBuffer;
final class XxHashes {
private final HashStream64 stream;
XxHashes(String algorithm) {
stream = switch (algorithm) {
case "XXHASH64" -> Hashing.xxh64().hashStream();
case "XXHASH3" -> Hashing.xxh3_64().hashStream();
case "XXHASH128" -> Hashing.xxh3_128().hashStream();
default -> throw new IllegalArgumentException(algorithm);
};
}
void update(byte[] bytes, int offset, int length) {
stream.putBytes(bytes, offset, length);
}
byte[] digest() {
if (stream instanceof HashStream128 wide) {
var value = wide.get();
return ByteBuffer.allocate(16).putLong(value.getMostSignificantBits())
.putLong(value.getLeastSignificantBits()).array();
}
return ByteBuffer.allocate(8).putLong(stream.getAsLong()).array();
}
}