CrackMe.apk
Download file
package com.facebook.imageformat;
import com.facebook.common.internal.Preconditions;
import java.io.UnsupportedEncodingException;
public class ImageFormatCheckerUtils {
public static byte[] asciiBytes(String str) {
Preconditions.checkNotNull(str);
try {
return str.getBytes("ASCII");
} catch (UnsupportedEncodingException e) {
throw new RuntimeException("ASCII not found!", e);
}
}
public static boolean startsWithPattern(byte[] bArr, byte[] bArr2) {
return hasPatternAt(bArr, bArr2, 0);
}
public static boolean hasPatternAt(byte[] bArr, byte[] bArr2, int i) {
Preconditions.checkNotNull(bArr);
Preconditions.checkNotNull(bArr2);
if (bArr2.length + i > bArr.length) {
return false;
}
for (int i2 = 0; i2 < bArr2.length; i2++) {
if (bArr[i + i2] != bArr2[i2]) {
return false;
}
}
return true;
}
public static int indexOfPattern(byte[] bArr, int i, byte[] bArr2, int i2) {
Preconditions.checkNotNull(bArr);
Preconditions.checkNotNull(bArr2);
if (i2 > i) {
return -1;
}
int i3 = 0;
byte b = bArr2[0];
int i4 = i - i2;
while (i3 <= i4) {
int i5 = 1;
if (bArr[i3] != b) {
do {
i3++;
if (i3 > i4) {
break;
}
} while (bArr[i3] == b);
}
if (i3 <= i4) {
int i6 = i3 + 1;
int i7 = (i6 + i2) - 1;
while (i6 < i7 && bArr[i6] == bArr2[i5]) {
i6++;
i5++;
}
if (i6 == i7) {
return i3;
}
}
i3++;
}
return -1;
}
private ImageFormatCheckerUtils() {
}
}
Download file