yck1509 / ConfuserEx

An open-source, free protector for .NET applications
http://yck1509.github.io/ConfuserEx/
Other
3.54k stars 1.61k forks source link

Customized ConfuserEx #444

Open uniqmr opened 8 years ago

uniqmr commented 8 years ago

Dear Sir, Sorry to bother you again.

var l = (uint)Mutation.KeyI0;
uint[] q = Mutation.Placeholder(new uint[Mutation.KeyI0]);

            var k = new uint[0x10];
            var n = (uint)Mutation.KeyI1;
            for (int i = 0; i < 0x10; i++)
           {
                n ^= n >> 12;
                n ^= n << 25;
                n ^= n >> 27;
                k[i] = n;
            }

If I change the above code like following..

var l = (uint)Mutation.KeyI0;
uint[] q = Mutation.Placeholder(new uint[Mutation.KeyI0]);

            var k = new uint[0x16];    
            var n = (uint)Mutation.KeyI1;
            for (int i = 0; i < 0x16; i++)
           {
                n ^= n >> 14;
                n ^= n << 25;
                n ^= n >> 27;
                k[i] = n;
            }

Will it be customized version of ConfuserEx? Will it cause any error inside?

Thanks

yck1509 commented 8 years ago

Hi, Yes it could be customized like this. However, you will need to change the corresponding part in the encryption process (in EncodePhase.cs).

uniqmr commented 8 years ago

Thanks for reply. In Constant.cs : I wrote:

var k = new uint[0x12];
var n = (uint)Mutation.KeyI1;
for (int i = 0; i < 0x12; i++) {
    n ^= n >> 12;
    n ^= n << 25;
    n ^= n >> 27;
    k[i] = n;
}

In EncodePhase.cs: I wrote :

var key = new uint[0x12];
uint state = keySeed;
for (int i = 0; i < 0x12; i++) {
    state ^= state >> 12;
    state ^= state << 25;
    state ^= state >> 27;
    key[i] = state;
}

Now, after encrypted by customized ConfuserEx, my Software is running well and app size is much smaller (213KB vs 136KB) than that was encrypted by your ConfuserEx 0.6.0.

Is it ok? Why size is smaller?

yck1509 commented 8 years ago

You may want to use the latest source code to base your edit on, since I fixed a bug that would cause this to happen.

uniqmr commented 8 years ago

Thanks. Brother, Best of luck.

uniqmr commented 8 years ago

Dear Sir, Modification I have made above is not working in your latest source.

In Constant.cs : I wrote:

var k = new uint[0x12];  // instead of 0x10
var n = (uint)Mutation.KeyI1;
for (int i = 0; i < 0x12; i++) {  // instead of 0x10
    n ^= n >> 12;
    n ^= n << 25;
    n ^= n >> 27;
    k[i] = n;
}

In EncodePhase.cs: I wrote :

var key = new uint[0x12];   // instead of 0x10
uint state = keySeed;
for (int i = 0; i < 0x12; i++) {  // instead of 0x10
    state ^= state >> 12;
    state ^= state << 25;
    state ^= state >> 27;
    key[i] = state;
}

With Normal protection preset it shows the error, please see the attached file. Please help me on this issue. confuser

Thanks.

Dexx77 commented 5 years ago

Some problem... how to fix...? What have I to change in the same part ?