The encrypted code is the payload. To make different versions of the code, in each copy the garbage lines which manipulate C will change. The code inside "Encrypted" ("lots of encrypted code") can search the code between Decryption_Code and CryptoKey and each algorithm for new code that does the same thing. Usually, the coder uses a zero key (for example; A [[xor]] 0 = A) for the first generation of the virus, making it easier for the coder because with this key the code is not encrypted. The coder then implements an incremental key algorithm or a random one.
== Polymorphic encryption ==
Polymorphic code can be also used to generate encryption algorithms. This code was generated by the online service StringEncrypt.<ref name="stringencrypt">[https://www.stringencrypt.com Wójcik, Bartosz (2015). ''String & File Encryption'']</ref> It takes the string or a file content and encrypts it with random encryption commands and generates polymorphic decryption code in one of the many supported programming languages:
<syntaxhighlight lang="cpp">
// encrypted with https://www.stringencrypt.com (v1.1.0) [C/C++]
// szLabel = "Wikipedia"
wchar_t szLabel[10] = { 0xB1A8, 0xB12E, 0xB0B4, 0xB03C, 0x33B9, 0xB30C, 0x3295, 0xB260, 0xB5E5, 0x35A2 };
for (unsigned tUTuj = 0, KRspk = 0; tUTuj < 10; tUTuj++) {
KRspk = szLabel[tUTuj];
KRspk ^= 0x2622;
KRspk = ~KRspk;
KRspk --;
KRspk += tUTuj;
KRspk = (((KRspk & 0xFFFF) >> 3) | (KRspk << 13)) & 0xFFFF;
KRspk += tUTuj;
KRspk --;
KRspk = ((KRspk << 8) | ( (KRspk & 0xFFFF) >> 8)) & 0xFFFF;
KRspk ^= 0xE702;
KRspk = ((KRspk << 4) | ( (KRspk & 0xFFFF) >> 12)) & 0xFFFF;
KRspk ^= tUTuj;
KRspk ++;
KRspk = (((KRspk & 0xFFFF) >> 8) | (KRspk << 8)) & 0xFFFF;
KRspk = ~KRspk;
szLabel[tUTuj] = KRspk;
}
wprintf(szLabel);
</syntaxhighlight>
As you can see in this C++ example, the string was encrypted and each character was stored in encrypted form using [[UNICODE]] widechar format. Different encryption commands were used like bitwise [[XOR]], [[Bitwise NOT|NOT]], addition, subtraction, bit rotations. Everything is randomized, encryption keys, bit rotation counters and encryption commands order as well. Output code can be generated in [[C/C++]], [[C Sharp (programming language)|C#]], [[Java (programming language)|Java]], [[JavaScript]], [[Python (programming language)|Python]], [[Ruby (programming language)|Ruby]], [[Haskell (programming language)|Haskell]], [[MASM]], [[FASM]] and [[AutoIt]]. Thanks to the randomization the generated algorithm is different every time. It's not possible to write generic decryption tools and the compiled code with polymorphic encryption code has to be analyzed each time it's re-encrypted.
Some tools use polymorphic encryption for data privacy, running multiple encryption algorithms to break up sensitive data into usable components. This allows users to generate and use large sets of data without decrypting them. <ref>{{Cite web |date=2021-07-21 |title=Skyflow Polymorphic Encryption Enables Secure PII Data |url=https://www.developer.com/security/skyflow-employs-polymorphic-encryption-enabling-secure-pii-data/ |access-date=2022-08-11 |website=Developer.com |language=en-US}}</ref><ref>{{Cite web |title=What is Polymorphic Encryption? - Skyflow |url=https://www.skyflow.com/post/a-look-at-polymorphic-encryption-the-new-paradigm-of-data-privacy |access-date=2022-08-11 |website=www.skyflow.com}}</ref>
== See also ==
|