Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>The simplest practical form is an <a href="http://en.wikipedia.org/wiki/XOR_cipher">XOR cipher</a>. Basically you generate an encryption/decryption key of random numbers, of any length. To encrypt or decrypt your data, XOR the data with the key.</p> <p>It is not very secure; it's mostly just used to do a light obfuscation.</p> <pre><code>#include &lt;vector&gt; typedef unsigned __int8 BYTE; std::vector&lt;BYTE&gt; xor_encryptdecrypt(const std::vector&lt;BYTE&gt;&amp; encryptionKey, const std::vector&lt;BYTE&gt;&amp; input) { std::vector&lt;BYTE&gt; ret; ret.reserve(input.size()); std::vector&lt;BYTE&gt;::const_iterator keyIterator = encryptionKey.begin(); for(std::vector&lt;BYTE&gt;::const_iterator inputIterator = input.begin(); inputIterator != input.end(); ++ inputIterator) { ret.push_back(*inputIterator ^ *keyIterator); // advance the key iterator, wrapping to begin. if(++ keyIterator == encryptionKey.end()) keyIterator = encryptionKey.begin(); } return ret; } int main() { // variable-length key of randomness, used for both encryption and decryption. std::vector&lt;BYTE&gt; key; key.push_back(0x55); key.push_back(0xae); key.push_back(0x8c); key.push_back(0x14); std::vector&lt;BYTE&gt; input; input.push_back(0x00); input.push_back(0x01); input.push_back(0x02); input.push_back(0x03); input.push_back(0x04); input.push_back(0x05); // encrypt std::vector&lt;BYTE&gt; encrypted = xor_encryptdecrypt(key, input); // decrypt std::vector&lt;BYTE&gt; decrypted = xor_encryptdecrypt(key, encrypted); return 0; } </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload