Search code examples
c++cryptographycellular-automatablock-cipherfeistel-cipher

Errant segments in cellular automata encryption algorithm


I've been implementing a paper that is targeting IoT encryption using a 64-bit block cipher via elementary cellular automata. The paper is in the repository/linked in the README.

I am trying to verify that an implementation of this algorithm actually works.

Current state

The first and third segments do not decrypt properly, I believe this is due to rule 153 being used.

P: deadbeefcafebabe
K: f6c78663f3578746
E: ce09ac834be8ba8d
D: df8cbeefcbcbbabe

Things I've verified

  • The CA works like Wolfram's and the specified rules in the paper
  • Splitting/concatenating segments works as expected

Errata I've noticed in the paper

  • There are unspecified CA boundaries (implementation should be correct as I'm getting half the plaintext out)
  • Selected rule 204 is essentially a NOP
  • 16x4 bit split in decryption should be 4x6
    • Correct in diagram (figure 3), not in algorithm listing
  • Decryption needs to invert the even/odd segment check

Question

Does rule 153 actually work for reversing the automata during decryption? Rule 51 is essentially a NOT on the previous epoch, so I would expect rule 153's inverse to be in use during decryption, but doesn't appear to be reversible.

If anyone could take a look and provide feedback on where I went wrong I'd greatly appreciate it. I've already mailed the author and have yet to receive a response.

Code

https://github.com/optimisticninja/caencryption


Solution

  • After iterating through all automata rules, only linear rules work in place of 153 for alternating segments. Rule 29 appears to be the best alternate for diffusion of the plaintext.

    RULE 29
    P: deadbeefcafebabe
    K: f6c78663f3578746
    E: ce09bfd34be8a898
    D: deadbeefcafebabe
    RULE 51
    P: deadbeefcafebabe
    K: f6c78663f3578746
    E: ce09bfd34be8a898
    D: deadbeefcafebabe
    RULE 204
    P: deadbeefcafebabe
    K: f6c78663f3578746
    E: ce09bfd34be8a898
    D: deadbeefcafebabe
    RULE 205
    P: deadbeefcafebabe
    K: f6c78663f3578746
    E: ce09bfd34be8a898
    D: deadbeefcafebabe