refactor: refactor Obfuz project, simplify codes.

before-split
walon 2025-05-18 10:36:45 +08:00
parent d2b730dad2
commit 7619928b07
8 changed files with 26 additions and 62 deletions

View File

@ -16,14 +16,14 @@ public class Bootstrap : MonoBehaviour
Debug.Log("SetUpStaticSecret end"); Debug.Log("SetUpStaticSecret end");
} }
// Start is called before the first frame update public int Add(int a, int b)
{
return a + b;
}
void Start() void Start()
{ {
var c = new Algorithm(); int a = Add(100, 200);
int a = c.Add(100, 200);
Debug.Log($"a = {a}"); Debug.Log($"a = {a}");
int b = c.ComputeHashCode(a);
Debug.Log($"b = {b}");
} }
} }

View File

@ -1,13 +1,10 @@
<mapping> <mapping>
<assembly name="Assembly-CSharp"> <assembly name="Assembly-CSharp">
<type fullName="Algorithm" newFullName="$a" status="Renamed"> <type fullName="Bootstrap" newFullName="" status="NotRenamed">
<method signature="int Algorithm::Add([Assembly-CSharp]Algorithm, int, int)" newName="$a" oldStackTraceSignature="Algorithm:Add(Int32, Int32)" newStackTraceSignature="$a:$a(Int32, Int32)"> <method signature="int Bootstrap::Add([Assembly-CSharp]Bootstrap, int, int)" newName="$a" oldStackTraceSignature="Bootstrap:Add(Int32, Int32)" newStackTraceSignature="Bootstrap:$a(Int32, Int32)">
<param index="1" newName="1" /> <param index="1" newName="1" />
<param index="2" newName="1" /> <param index="2" newName="1" />
</method> </method>
<method signature="int Algorithm::ComputeHashCode([Assembly-CSharp]Algorithm, int)" newName="$A" oldStackTraceSignature="Algorithm:ComputeHashCode(Int32)" newStackTraceSignature="$a:$A(Int32)">
<param index="1" newName="1" />
</method>
</type> </type>
<type fullName="Obfuz.EncryptionVM.GeneratedEncryptionVirtualMachine" newFullName="$a.$A" status="Renamed"> <type fullName="Obfuz.EncryptionVM.GeneratedEncryptionVirtualMachine" newFullName="$a.$A" status="Renamed">
<field signature="int kOpCodeBits" newName="$a" /> <field signature="int kOpCodeBits" newName="$a" />
@ -38,11 +35,11 @@
</method> </method>
</type> </type>
<type fullName="&lt;PrivateImplementationDetails&gt;" newFullName="$b" status="Renamed"> <type fullName="&lt;PrivateImplementationDetails&gt;" newFullName="$b" status="Renamed">
<field signature="[Assembly-CSharp]&lt;PrivateImplementationDetails&gt;/__StaticArrayInitTypeSize=87 331CA39465764E7DCBE9D86F4330ECCF01BEA2C515D12E3C85AD65689CF5D169" newName="$a" /> <field signature="[Assembly-CSharp]&lt;PrivateImplementationDetails&gt;/__StaticArrayInitTypeSize=86 230748DE32A7B14F2A36EEA88E8693F9862DC7AC35B0BA73ACB9E47C6A6EC891" newName="$a" />
<field signature="[Assembly-CSharp]&lt;PrivateImplementationDetails&gt;/__StaticArrayInitTypeSize=130 E80BB66678F959843570A18381C8FF647BDCE6DF9D5AD8477C3F03A04DFFE3B7" newName="$A" /> <field signature="[Assembly-CSharp]&lt;PrivateImplementationDetails&gt;/__StaticArrayInitTypeSize=72 A9CE10ECCCBCA424528AF2C7F835672596125B19DA54C2D7FBBFA1840795ACE2" newName="$A" />
</type> </type>
<type fullName="&lt;PrivateImplementationDetails&gt;/__StaticArrayInitTypeSize=87" newFullName="$b/$B" status="Renamed" /> <type fullName="&lt;PrivateImplementationDetails&gt;/__StaticArrayInitTypeSize=72" newFullName="$b/$a" status="Renamed" />
<type fullName="&lt;PrivateImplementationDetails&gt;/__StaticArrayInitTypeSize=130" newFullName="$b/$c" status="Renamed" /> <type fullName="&lt;PrivateImplementationDetails&gt;/__StaticArrayInitTypeSize=86" newFullName="$b/$B" status="Renamed" />
<type fullName="$ObfuzRVA$DataHolder4096" newFullName="$C" status="Renamed" /> <type fullName="$ObfuzRVA$DataHolder4096" newFullName="$C" status="Renamed" />
<type fullName="$Obfuz$RVA$" newFullName="$d" status="Renamed"> <type fullName="$Obfuz$RVA$" newFullName="$d" status="Renamed">
<field signature="[Assembly-CSharp]$ObfuzRVA$DataHolder4096 $RVA_Data0" newName="$a" /> <field signature="[Assembly-CSharp]$ObfuzRVA$DataHolder4096 $RVA_Data0" newName="$a" />
@ -50,13 +47,11 @@
</type> </type>
<type fullName="$Obfuz$ConstFieldHolder$0" newFullName="$D" status="Renamed"> <type fullName="$Obfuz$ConstFieldHolder$0" newFullName="$D" status="Renamed">
<field signature="string $Obfuz$RVA_Value0" newName="$a" /> <field signature="string $Obfuz$RVA_Value0" newName="$a" />
<field signature="string $Obfuz$RVA_Value1" newName="$A" />
</type> </type>
<type fullName="$Obfuz$ProxyCall" newFullName="$e" status="Renamed"> <type fullName="$Obfuz$ProxyCall" newFullName="$e" status="Renamed">
<method signature="int $Obfuz$ProxyCall::$Obfuz$ProxyCall$Dispatch$0(object, int, int, int, int)" newName="$a" oldStackTraceSignature="$Obfuz$ProxyCall:$Obfuz$ProxyCall$Dispatch$0(Object, Int32, Int32, Int32, Int32)" newStackTraceSignature="$e:$a(Object, Int32, Int32, Int32, Int32)" /> <method signature="int $Obfuz$ProxyCall::$Obfuz$ProxyCall$Dispatch$0(object, int, int, int, int)" newName="$a" oldStackTraceSignature="$Obfuz$ProxyCall:$Obfuz$ProxyCall$Dispatch$0(Object, Int32, Int32, Int32, Int32)" newStackTraceSignature="$e:$a(Object, Int32, Int32, Int32, Int32)" />
<method signature="int $Obfuz$ProxyCall::$Obfuz$ProxyCall$Dispatch$1(object, int, int, int)" newName="$A" oldStackTraceSignature="$Obfuz$ProxyCall:$Obfuz$ProxyCall$Dispatch$1(Object, Int32, Int32, Int32)" newStackTraceSignature="$e:$A(Object, Int32, Int32, Int32)" /> <method signature="int $Obfuz$ProxyCall::$Obfuz$ProxyCall$Dispatch$1(object, int, int, int)" newName="$A" oldStackTraceSignature="$Obfuz$ProxyCall:$Obfuz$ProxyCall$Dispatch$1(Object, Int32, Int32, Int32)" newStackTraceSignature="$e:$A(Object, Int32, Int32, Int32)" />
<method signature="void $Obfuz$ProxyCall::$Obfuz$ProxyCall$Dispatch$2(object, int)" newName="$b" oldStackTraceSignature="$Obfuz$ProxyCall:$Obfuz$ProxyCall$Dispatch$2(Object, Int32)" newStackTraceSignature="$e:$b(Object, Int32)" /> <method signature="void $Obfuz$ProxyCall::$Obfuz$ProxyCall$Dispatch$2(object, int)" newName="$b" oldStackTraceSignature="$Obfuz$ProxyCall:$Obfuz$ProxyCall$Dispatch$2(Object, Int32)" newStackTraceSignature="$e:$b(Object, Int32)" />
<method signature="int $Obfuz$ProxyCall::$Obfuz$ProxyCall$Dispatch$3(object, int, int)" newName="$B" oldStackTraceSignature="$Obfuz$ProxyCall:$Obfuz$ProxyCall$Dispatch$3(Object, Int32, Int32)" newStackTraceSignature="$e:$B(Object, Int32, Int32)" />
</type> </type>
</assembly> </assembly>
<assembly name="Obfuz.Runtime"> <assembly name="Obfuz.Runtime">

View File

@ -1,8 +0,0 @@
fileFormatVersion: 2
guid: c71b39fcf194d5049b95088ff01dd2cc
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -1,18 +0,0 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Algorithm
{
public int Add(int a, int b)
{
return a + b;
}
public int ComputeHashCode(int a)
{
int hash = 17;
hash = hash * 23 + a.GetHashCode();
return hash;
}
}

View File

@ -1,11 +0,0 @@
fileFormatVersion: 2
guid: 092862882a7a7ba43ac257ac990b1fb8
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -877,6 +877,7 @@ PlayerSettings:
Standalone: 1 Standalone: 1
il2cppCompilerConfiguration: il2cppCompilerConfiguration:
Android: 0 Android: 0
Standalone: 0
il2cppCodeGeneration: {} il2cppCodeGeneration: {}
managedStrippingLevel: managedStrippingLevel:
EmbeddedLinux: 1 EmbeddedLinux: 1

View File

@ -24,27 +24,32 @@ using $a;
using $A; using $A;
using UnityEngine; using UnityEngine;
// Token: 0x02000003 RID: 3 // Token: 0x02000002 RID: 2
public class Bootstrap : MonoBehaviour public class Bootstrap : MonoBehaviour
{ {
// Token: 0x06000004 RID: 4 RVA: 0x0000313D File Offset: 0x0000133D // Token: 0x06000001 RID: 1 RVA: 0x000030F0 File Offset: 0x000012F0
[RuntimeInitializeOnLoadMethod(2)] [RuntimeInitializeOnLoadMethod(2)]
private static void SetUpStaticSecret() private static void SetUpStaticSecret()
{ {
Debug.Log("SetUpStaticSecret begin"); Debug.Log("SetUpStaticSecret begin");
global::$A.$C<$c>.$L = new global::$a.$A(Resources.Load<TextAsset>("Obfuz/defaultStaticSecret").bytes); global::$A.$C<$c>.$L = new $a.$A(Resources.Load<TextAsset>("Obfuz/defaultStaticSecretKey").bytes);
Debug.Log("SetUpStaticSecret end"); Debug.Log("SetUpStaticSecret end");
} }
// Token: 0x06000005 RID: 5 RVA: 0x000032E0 File Offset: 0x000014E0 // Token: 0x06000002 RID: 2 RVA: 0x0000311F File Offset: 0x0000131F
public int $a(int 1, int 1)
{
return 1 + 1;
}
// Token: 0x06000003 RID: 3 RVA: 0x00003204 File Offset: 0x00001404
private void Start() private void Start()
{ {
global::$a $a = new global::$a(); int num = global::$e.$A(this, global::$e.$a(global::$d.$A, 0, 117, -2060908889, global::$A.$C<$c>.$d(-1139589574, 85, -452785586)), global::$e.$a(global::$d.$A, 4, 138, -1222258517, global::$A.$C<$c>.$d(-1139589574, 85, -452785586)), global::$A.$C<$c>.$d(1757957431, 242, 760404455));
int num = global::$e.$A($a, global::$e.$a(global::$d.$A, 8, 117, -2060908889, global::$A.$C<$c>.$d(-1139589574, 85, -452785586)), global::$e.$a(global::$d.$A, 12, 138, -1222258517, global::$A.$C<$c>.$d(-1139589574, 85, -452785586)), global::$A.$C<$c>.$d(-595938299, 185, 132898840));
global::$e.$b(string.Format(global::$D.$a, num), global::$A.$C<$c>.$d(1718597184, 154, 2114032877)); global::$e.$b(string.Format(global::$D.$a, num), global::$A.$C<$c>.$d(1718597184, 154, 2114032877));
int num2 = global::$e.$B($a, num, global::$A.$C<$c>.$d(368894728, 171, -1414000938));
global::$e.$b(string.Format(global::$D.$A, num2), global::$A.$C<$c>.$d(1718597184, 154, 2114032877));
} }
} }
``` ```