Skip to content

Commit

Permalink
fix: align checksum buffersize android to 5mb
Browse files Browse the repository at this point in the history
  • Loading branch information
riderx committed Jan 22, 2024
1 parent cc7bebe commit 51eeae8
Showing 1 changed file with 10 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -488,16 +488,17 @@ private void setCurrentBundle(final File bundle) {
}

private String getChecksum(File file) throws IOException {
CRC32 crc = new CRC32();
try (FileInputStream fis = new FileInputStream(file)) {
byte[] buffer = new byte[1024];
int length;
while ((length = fis.read(buffer)) != -1) {
crc.update(buffer, 0, length);
final int BUFFER_SIZE = 1024 * 1024 * 5; // 5 MB buffer size
CRC32 crc = new CRC32();
try (FileInputStream fis = new FileInputStream(file)) {
byte[] buffer = new byte[BUFFER_SIZE];
int length;
while ((length = fis.read(buffer)) != -1) {
crc.update(buffer, 0, length);
}
}
}
String enc = String.format("%08X", crc.getValue());
return enc.toLowerCase();
String enc = String.format("%08X", crc.getValue());
return enc.toLowerCase();
}

private void decryptFile(
Expand Down

0 comments on commit 51eeae8

Please sign in to comment.