Trim signature varaint number off for memory savings

This commit is contained in:
Tad 2018-10-21 15:40:54 -04:00
parent 272a51304c
commit 521ae4891d
2 changed files with 9 additions and 1 deletions

View file

@ -133,11 +133,17 @@ class Database {
if (database.getName().contains(".hdb")) {//.hdb format: md5, size, name if (database.getName().contains(".hdb")) {//.hdb format: md5, size, name
while ((line = reader.readLine()) != null) { while ((line = reader.readLine()) != null) {
String[] lineS = line.split(":"); String[] lineS = line.split(":");
if(Utils.TRIM_VARIANT_NUMBER) {
lineS[2] = lineS[2].split("-")[0];
}
signaturesMD5.put(lineS[0].substring(0, Utils.MAX_HASH_LENGTH), lineS[2]); signaturesMD5.put(lineS[0].substring(0, Utils.MAX_HASH_LENGTH), lineS[2]);
} }
} else if (database.getName().contains(".hsb")) {//.hsb format: sha256, size, name } else if (database.getName().contains(".hsb")) {//.hsb format: sha256, size, name
while ((line = reader.readLine()) != null) { while ((line = reader.readLine()) != null) {
String[] lineS = line.split(":"); String[] lineS = line.split(":");
if(Utils.TRIM_VARIANT_NUMBER) {
lineS[2] = lineS[2].split("-")[0];
}
if (lineS[0].length() == 32) { if (lineS[0].length() == 32) {
signaturesSHA1.put(lineS[0].substring(0, Utils.MAX_HASH_LENGTH), lineS[2]); signaturesSHA1.put(lineS[0].substring(0, Utils.MAX_HASH_LENGTH), lineS[2]);
} else { } else {

View file

@ -36,7 +36,9 @@ class Utils {
public final static int MAX_SCAN_SIZE = (1000 * 1000) * 80; //80MB public final static int MAX_SCAN_SIZE = (1000 * 1000) * 80; //80MB
public final static int MAX_SCAN_SIZE_REALTIME = MAX_SCAN_SIZE / 2; //40MB public final static int MAX_SCAN_SIZE_REALTIME = MAX_SCAN_SIZE / 2; //40MB
public final static int MAX_HASH_LENGTH = 16; public final static int MAX_HASH_LENGTH = 12;
public final static boolean TRIM_VARIANT_NUMBER = true;
public static int FILES_SCANNED = 0; public static int FILES_SCANNED = 0;
private static ThreadPoolExecutor threadPoolExecutor = null; private static ThreadPoolExecutor threadPoolExecutor = null;