Example #1
0
		public void Init(ConfuserContext ctx, RandomGenerator random) {
			StatementBlock dummy;
			ctx.Registry.GetService<IDynCipherService>().GenerateCipherPair(random, out derivation, out dummy);

			var dmCodeGen = new DMCodeGen(typeof(void), new[] {
				Tuple.Create("{BUFFER}", typeof(uint[])),
				Tuple.Create("{KEY}", typeof(uint[]))
			});
			dmCodeGen.GenerateCIL(derivation);
			encryptFunc = dmCodeGen.Compile<Action<uint[], uint[]>>();
		}
Example #2
0
        public void Init(ConfuserContext ctx, RandomGenerator random)
        {
            ctx.Registry.GetService <IDynCipherService>().GenerateCipherPair(random, out derivation, out var dummy);

            var dmCodeGen = new DMCodeGen(typeof(void), new[] {
                Tuple.Create("{BUFFER}", typeof(uint[])),
                Tuple.Create("{KEY}", typeof(uint[]))
            });

            dmCodeGen.GenerateCIL(derivation);
            encryptFunc = dmCodeGen.Compile <Action <uint[], uint[]> >();
        }
Example #3
0
		public IEnumerable<Instruction> EmitDecrypt(MethodDef init, CEContext ctx, Local block, Local key) {
			StatementBlock encrypt, decrypt;
			ctx.DynCipher.GenerateCipherPair(ctx.Random, out encrypt, out decrypt);
			var ret = new List<Instruction>();

			var codeGen = new CodeGen(block, key, init, ret);
			codeGen.GenerateCIL(decrypt);
			codeGen.Commit(init.Body);

			var dmCodeGen = new DMCodeGen(typeof(void), new[] {
				Tuple.Create("{BUFFER}", typeof(uint[])),
				Tuple.Create("{KEY}", typeof(uint[]))
			});
			dmCodeGen.GenerateCIL(encrypt);
			encryptFunc = dmCodeGen.Compile<Action<uint[], uint[]>>();

			return ret;
		}
Example #4
0
        public IEnumerable <Instruction> EmitDecrypt(MethodDef init, REContext ctx, Local block, Local key)
        {
            ctx.DynCipher.GenerateCipherPair(ctx.Random, out StatementBlock encrypt, out StatementBlock decrypt);
            var ret = new List <Instruction>();

            var codeGen = new CodeGen(block, key, init, ret);

            codeGen.GenerateCIL(decrypt);
            codeGen.Commit(init.Body);

            var dmCodeGen = new DMCodeGen(typeof(void), new[] {
                Tuple.Create("{BUFFER}", typeof(uint[])),
                Tuple.Create("{KEY}", typeof(uint[]))
            });

            dmCodeGen.GenerateCIL(encrypt);
            encryptFunc = dmCodeGen.Compile <Action <uint[], uint[]> >();

            return(ret);
        }
Example #5
0
        // Token: 0x0600018D RID: 397 RVA: 0x00061318 File Offset: 0x0005F518
        public IEnumerable <Instruction> EmitDecrypt(MethodDef init, REContext ctx, Local block, Local key)
        {
            StatementBlock statement;
            StatementBlock statement2;

            ctx.DynCipher.GenerateCipherPair(ctx.Random, out statement, out statement2);
            List <Instruction> list = new List <Instruction>();

            DynamicMode.CodeGen codeGen = new DynamicMode.CodeGen(block, key, init, list);
            codeGen.GenerateCIL(statement2);
            codeGen.Commit(init.Body);
            DMCodeGen dmcodeGen = new DMCodeGen(typeof(void), new Tuple <string, Type>[]
            {
                Tuple.Create <string, Type>("{BUFFER}", typeof(uint[])),
                Tuple.Create <string, Type>("{KEY}", typeof(uint[]))
            });

            dmcodeGen.GenerateCIL(statement);
            this.encryptFunc = dmcodeGen.Compile <Action <uint[], uint[]> >();
            return(list);
        }