Added Apply unpacker menu on binary data

Added Harman unpacker for binary data
Added Multilevel binary data unpacking is possible
This commit is contained in:
Jindra Petřík
2023-12-30 18:06:08 +01:00
parent 8ad981ff25
commit 9741e8260a
23 changed files with 783 additions and 210 deletions
@@ -32,25 +32,7 @@ import javax.crypto.spec.SecretKeySpec;
public class HarmanBinaryDataEncrypt {
private static final String GLOBAL_KEY = "Adobe AIR SDK (c) 2021 HARMAN Internation Industries Incorporated";
private static final String[] hexStringCache;
static {
hexStringCache = new String[256];
for (int i = 0; i < hexStringCache.length; i++) {
hexStringCache[i] = String.format("%02x", i);
}
}
public static String byteArrayToHex(byte[] data) {
StringBuilder sb = new StringBuilder(data.length * 2);
for (byte b : data) {
sb.append(hexStringCache[b & 0xff]);
}
return sb.toString();
}
private static final String GLOBAL_KEY = "Adobe AIR SDK (c) 2021 HARMAN Internation Industries Incorporated";
public static byte[] encrypt(byte[] data) {
byte[] result;
@@ -153,6 +135,9 @@ public class HarmanBinaryDataEncrypt {
}
public static byte[] decrypt(byte[] data) {
if (data.length < 32) {
return null;
}
long encryptedLen = data.length;
long encryptedLenXorHash = unpack(data, 0);
long decryptedLenXorRandom1 = unpack(data, 4);
@@ -19,9 +19,6 @@ package com.jpexs.decompiler.flash.harman;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.DataInputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.security.InvalidAlgorithmParameterException;
@@ -44,26 +41,7 @@ import javax.crypto.spec.SecretKeySpec;
*/
public class HarmanSwfEncrypt {
private static final String GLOBAL_KEY = "Adobe AIR SDK (c) 2021 HARMAN Internation Industries Incorporated";
private static final String[] hexStringCache;
static {
hexStringCache = new String[256];
for (int i = 0; i < hexStringCache.length; i++) {
hexStringCache[i] = String.format("%02x", i);
}
}
public static String byteArrayToHex(byte[] data) {
StringBuilder sb = new StringBuilder(data.length * 2);
for (byte b : data) {
sb.append(hexStringCache[b & 0xff]);
}
return sb.toString();
}
private static final String GLOBAL_KEY = "Adobe AIR SDK (c) 2021 HARMAN Internation Industries Incorporated";
private static int sum(byte[] data) {
int s = 0;