Imagine highly dystopian environment, where oppressive evil government MITMs over all connections and uses DPI to thwart any attempts to use TLS/SSL, TOR, I2P etc. To establish connection, these protocols first need to communicate a little in cleartext, and if DPI can identify handshake packet, connection will be closed. Using custom protocols or protocol modifications to fight this mechanism is not viable option, because officials monitor everything passing through network filter and almost immediately adapt DPI rules to new versions.

I had thought of an idea to make a protocol that would be practically impossible to create a rule against. Something that can be used to make otherwise plaintext data (protocol versions, list of ciphers, public key fingerprints, DH exchanges) look random and uniform, but yet be easily reversible.

I could think of following option:

Infinite alphabet hash substitution cipher

Each octet of plaintext string gets mapped to a large chunk of completely random data. First octet of hash of that data matches desired octet.

Encoding procedure in almost Python:

pool = {}
stegotext = ''

for octet in cleartext:
    while octet not in pool:
        chunk = generate_randomness(bytes=32)
        digest = calculate_hash(chunk)
        hash_octet = digest[0]

        if hash_octet not in pool:
            pool[hash_octet] = []


    chunk = draw_and_remove_random_element(pool[octet])
    stegotext += chunk

Given N bytes of input, result will be N * H bytes, where H is hash function size.

Decoding procedure:

plaintext = ''

for group in split_in_groups(stegotext, group_length=H):
    digest = calculate_hash(group)
    octet = digest[0]
    plaintext += octet

However, in case some computationally simple hash function is used, it's not hard for MITM to add rule that calculates hash function over each packet, and filters on results. To protect against this, PBKDF2 or scrypt could be used, so for legitimate party it does not take much resources to accept or initiate connection, yet MITM will be overwhelmed.

Question is: does it make any sense? Is it any better than just using headerless scrypt with large r value and prepended publicly sent key?


In an authoritarian dystopian environment, the authorities aren't going to permit every network transmission they can't prove is harmful, they're going to use a default-deny rule, and only permit transmissions they can prove are safe. In such an environment, you'll need to disguise your transmission as a known-safe protocol, such as HTTP or Telnet.

Even without that, your proposed protocol is statistically identical to strong encryption. Any dystopian authority worth their salt is going to block anything that looks like encryption.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.