[LG G6 Questions and Answers] Jerry181:
I somehow pulled something out of ChatGPT to create a java program that can generate the unlock.bin file. Do not take this as a miracle code, for I really have no clue about how it actually works but the snippet might give a hint of what to do:

import java.io.FileOutputStream;
import java.nio.ByteBuffer;
import java.security.KeyFactory;
import java.security.MessageDigest;
import java.security.PrivateKey;
import java.security.Signature;
import java.security.spec.PKCS8EncodedKeySpec;

public class UnlockBinGenerator {
private static final int UNLOCK_BIN_SIZE = 1024;
private static final int UINT32_T_SIZE = 4;
private static final int SIGNATURE_SIZE = 512;
private static final int KEY_SIZE = 256;
private static final int EXTRA_SIZE = 492;
private static final long SECURITY_UNLOCK_MAGIC1 = 2377586078L; // 0x8DB7159E
private static final long SECURITY_UNLOCK_MAGIC2 = 763286379L; // 0x2D7ED36B
private static final long SECURITY_UNLOCK_VERSION = 1L;
private static final int IMEI_SIZE = 32;
private static final int DEVICE_ID_SIZE = 96;

public static void main(String[] args) throws Exception {
byte[] magic1 = ByteBuffer.allocate(UINT32_T_SIZE).putInt((int) SECURITY_UNLOCK_MAGIC1).array();
byte[] magic2 = ByteBuffer.allocate(UINT32_T_SIZE).putInt((int) SECURITY_UNLOCK_MAGIC2).array();
byte[] version = ByteBuffer.allocate(UINT32_T_SIZE).putInt((int) SECURITY_UNLOCK_VERSION).array();
byte[] hashType = ByteBuffer.allocate(UINT32_T_SIZE).putInt(0).array(); // Assuming hash type 0
byte[] keySize = ByteBuffer.allocate(UINT32_T_SIZE).putInt(KEY_SIZE).array();

byte[] privateKeyBytes = Files.readAllBytes(Paths.get("private_key.der"));
PKCS8EncodedKeySpec keySpec = new PKCS8EncodedKeySpec(privateKeyBytes);
KeyFactory keyFactory = KeyFactory.getInstance("RSA");
PrivateKey privateKey = keyFactory.generatePrivate(keySpec);

byte[] signature = generateSignature(privateKey);
byte[] extra = new byte[EXTRA_SIZE]; // Fill in the extra data accordingly

String imei = "356144087429995";
String deviceId = "662CDCF3D09A5AED38E08DB652EC4CC6F63B24DADB2332BC0C7CD30A9924D731";
byte[] input = createInputData(imei, deviceId);

// Construct unlock.bin data
byte[] unlockBinData = ByteBuffer
.allocate(UNLOCK_BIN_SIZE)
.put(magic1)
.put(magic2)
.put(version)
.put(hashType)
.put(keySize)
.put(signature)
.put(extra)
.put(input)
.array();

// Write data to unlock.bin file
try (FileOutputStream fos = new FileOutputStream("unlock.bin")) {
fos.write(unlockBinData);
System.out.println("Unlock.bin file generated successfully.");
} catch (Exception e) {
e.printStackTrace();
}
}

private static byte[] generateSignature(PrivateKey privateKey) throws Exception {
Signature signature = Signature.getInstance("SHA256withRSA");
signature.initSign(privateKey);

// Assuming input is the data to be signed
byte[] input = "YourDataToBeSigned".getBytes();
signature.update(input);

return signature.sign();
}

private static byte[] createInputData(String imei, String deviceId) throws Exception {
byte[] input = new byte[DEVICE_ID_SIZE + IMEI_SIZE];
System.arraycopy(deviceId.getBytes(), 0, input, 0, deviceId.length());
System.arraycopy(imei.getBytes(), 0, input, DEVICE_ID_SIZE, imei.length());
return input;
}
}