Stack Poly-Engine Crypter for Secure String

Hide (crypt) string with a Polymorphic Dynamic Code (&quot;game&quot; with the Stack!).

Introduction

Interesting characteristic (for me!) of the .NET Framework is the possibility to simulate situations that were possible using the language assembler x86. I refer, in particular, to the STACK (sequence of data). The Stack can be considered (reductively) as an area of "temporary memory" in which the data is visible in inverse order to that of the insertion.

Background

To emulate another programming language in order "to confuse" the code against the decompilers!

Using the code

In .NET, therefore, class STACK is present. The main methods exposed from the .NET class STACK are following:

PUSH

Inserts the value in the stack. Equal instruction is present in the assembler language x86.

POP

Extracts the value from the stack. Equal instruction is present in the assembler language x86.

Understanding how the stack works in insertion/extraction of the data (*always* in inverse order), we are ready to implement our algorithm of cryptography. We want to realize it (relatively simple), effective, it turns out to you always random and that it comes dynamically executed from the compiler... then we want to construct a creative... Poly-Engine Crypter for the strings (...ehila! Who has said like the poly-engines present in the virus code? *yes* is the answer!). In this tutorial, I introduce to you *only* implementing dynamic code using the functions of: sum, subtraction, XOR (for the nostalgic programmers of the assembler language x86: add, sub, XOR) of byte.