mirror of
https://github.com/ebean-orm/ebean.git
synced 2026-11-12 22:41:35 +00:00
Change Checksum to use CRC32
This commit is contained in:
1 parent
991c6d6b5c
commit
0d8e7c852b
2 files changed
+12
-7
No files matched your search
@@ -1,7 +1,7 @@
|
||||
package io.ebeaninternal.server.util;
|
||||
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.zip.Adler32;
|
||||
import java.util.zip.CRC32;
|
||||
|
||||
/**
|
||||
* Compute a checksum for String content. Use when we desire cheaper option than MD5.
|
||||
@@ -12,9 +12,9 @@ public final class Checksum {
|
||||
* Return the checksum for the given String input.
|
||||
*/
|
||||
public static long checksum(String input) {
|
||||
Adler32 adler32 = new Adler32();
|
||||
CRC32 checksum = new CRC32();
|
||||
final byte[] bytes = input.getBytes(StandardCharsets.UTF_8);
|
||||
adler32.update(bytes, 0, bytes.length);
|
||||
return adler32.getValue();
|
||||
checksum.update(bytes, 0, bytes.length);
|
||||
return checksum.getValue();
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user