mirror of
https://github.com/HMCL-dev/HMCL.git
synced 2025-09-09 11:55:52 -04:00
fix IntegrityCheck::performCheck (#1792)
This commit is contained in:
parent
f75bbdcecc
commit
ff78297ee5
@ -17,6 +17,7 @@
|
||||
*/
|
||||
package org.jackhuang.hmcl.task;
|
||||
|
||||
import org.jackhuang.hmcl.util.Hex;
|
||||
import org.jackhuang.hmcl.util.Logging;
|
||||
import org.jackhuang.hmcl.util.io.ChecksumMismatchException;
|
||||
import org.jackhuang.hmcl.util.io.CompressingUtils;
|
||||
@ -25,7 +26,6 @@ import org.jackhuang.hmcl.util.io.FileUtils;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.io.RandomAccessFile;
|
||||
import java.math.BigInteger;
|
||||
import java.net.URL;
|
||||
import java.net.URLConnection;
|
||||
import java.nio.file.FileSystem;
|
||||
@ -72,7 +72,7 @@ public class FileDownloadTask extends FetchTask<Void> {
|
||||
}
|
||||
|
||||
public void performCheck(MessageDigest digest) throws ChecksumMismatchException {
|
||||
String actualChecksum = String.format("%1$040x", new BigInteger(1, digest.digest()));
|
||||
String actualChecksum = Hex.encodeHex(digest.digest());
|
||||
if (!checksum.equalsIgnoreCase(actualChecksum)) {
|
||||
throw new ChecksumMismatchException(algorithm, checksum, actualChecksum);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user