Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Assuming you are <em>only</em> looking for simple obfuscation that will obscure things from the <em>very</em> casual observer, and you aren't looking to use third party libraries. I'd recommend something like the Vigenere cipher. It is one of the strongest of the simple ancient ciphers.</p> <p><a href="https://en.wikipedia.org/wiki/Vigen%C3%A8re_cipher" rel="noreferrer">Vigenère cipher</a></p> <p>It's quick and easy to implement. Something like:</p> <pre><code>import base64 def encode(key, string): encoded_chars = [] for i in xrange(len(string)): key_c = key[i % len(key)] encoded_c = chr(ord(string[i]) + ord(key_c) % 256) encoded_chars.append(encoded_c) encoded_string = "".join(encoded_chars) return base64.urlsafe_b64encode(encoded_string) </code></pre> <p>Decode is pretty much the same, except you subtract the key.</p> <p>It is much harder to break if the strings you are encoding are short, and/or if it is hard to guess the length of the passphrase used. </p> <p>If you are looking for something cryptographic, PyCrypto is probably your best bet, though previous answers overlook some details: ECB mode in PyCrypto requires your message to be a multiple of 16 characters in length. So, you must pad. Also, if you want to use them as URL parameters, use <code>base64.urlsafe_b64_encode()</code>, rather than the standard one. This replaces a few of the characters in the base64 alphabet with URL-safe characters (as it's name suggests).</p> <p>However, you should be ABSOLUTELY certain that this <em>very</em> thin layer of obfuscation suffices for your needs before using this. The Wikipedia article I linked to provides detailed instructions for breaking the cipher, so anyone with a moderate amount of determination could easily break it.</p>
    singulars
    1. This table or related slice is empty.
    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.
 

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