r/ciphers • • 1d ago

Unsolved EncryptionEnigma: Encryption Program that uses rolling codebook to cipher

Hi all, See github for the versions. All working on Python 3.15

https://github.com/Empanti5/EncryptionEnigma

This is my password-based, authenticated, polyalphabetic substitution stream cipher. I started working on it as a passion project for fun in 2015, I then improved it in 2019 and only recently decided to refine it once more.

It uses rolling codebooks similar to the enigma machine, I didn't intend for it to use this method but that's just how it came to be. Only after I had a fully functioning program that worked did I realise the similar procress.

It works by converting characters in 5 character blocks, A becomes "woseG", B becomes "5Bduf" and so on. Each character of the phrase is encoded according to these blocks.

Then a count is started, using the nonce (Public key) and the private key, each codebook character changes depending on the private key's resulted seeded hash. It does this step by step, so the "woseG" becomes a completely different result.

How this works, the seeded table from the private and public key determines a unique shuffled table for a lookup tables for each character. Then character A "woseG" is looked up on the shuffled A table which has a predetermined rule, such as "for w in position 1 change to K" and would roll over for all 5 positions. Meaning there is a unique rolling change that determines position 1 changes to position 5 changes.

Everytime this change happens, the function rolls over a count and all the tables in the program change. This is the stream.

To decrypt, it does the opposite. Instead of replacing plaintext with the forever changing cipher text. It looks up the forever changes tables and attempts to match the cipher blocks to it's tables, if it has a match it replaces cipher with plaintext.

Because it includes a nonce at the start, you can use the same password and get a different result each time. A MAC is also used so that it will spit out an error if tampered.

The output cipher text is as follows: nonce (15 characters) + encrypted letters (5 per character) + tag (16). Padding is included in the encrypted letters and is included in the encryption procress.

**Please Note AI was used on v0.4.2, only 51 lines of the 409 usable code. It was used for the hash, seed, padding and MAC security features.** However, the overal cipher method is my design. I have included v0.3 which has no AI code but is not secure. v0.6 is experimental.

Overall:

* v0.3 is raw, no AI code. Not secure, included for transparency. Uses Strhandle function which I cannot begin to explain. It is some rolling design that got cut out in v0.4.2. It was a nightmare to code and it become redundant. It's predictability was it's downfall and usefulness.

* v0.4.2 is the most secure, efficient. Use this to see and play around with. Try to attack this if you can, that would be helpful for any feedback on this. AI is used for hash, seed, padding and MAC.

* v0.6 is a combination of v0.3 and v0.4.2. It uses the strhandle function, it's not practicable. And might be slow for longer phrases. Don't use this. I have included to show what I am working on next.

Any thoughts, or attempts at attacks would be great. I probably didn't explain it well enough. But it's just a crazy shuffle, rolling cipher that moves bunch of shit around by using well known cryptography libraries.

TLDR: Use v0.4.2

To try the encryption program v0.4.2 32bit for cipher:

EHcjWfsinFm2D8PySyAWp2ePTdWAUscLDF7Siu2y63l1K1S7YUiUTUhH4ias7G3scVPw0mxeJd2t177CN2lzWmLa5jlpSaqfJrmQeglxEqrHBFLX4IevIO0ZYm0L4SbhpVYaIGnMFvF2BncC52cKyRklOUkHycQZUUcTd6CnnV0Cz591ApV4qRhpvdSFrOWGZ7oxSOktPVruneI1Q4oLr8oWprg0ABfQcZEESs05Q3ZFTEG0QbdMvC1TDA4jHzpJOBlBRV6LTeKADKHLmNbYnkbGLf55O27A9KwKtpZlc3KuhBXA0RwHi7QAy5pXt6xtgpLTISEqDOiyUJPkdRK849zJpiD66RTD2epS0ipbFRLTqDX4IffYSQtKEp1LMIOFAX1SN3WWsIcCbT8EtVC0LvkSD6S5kVNhKpo4EuTbGJEqWjAc6rqL34rPPfMgmcnVlAwiMoh4XMfeZ8kEXdgcWzONl3f7P1gkCDjmlNBnpU11IMsiPnmQDdFBSFdOt6Qb963C7FZyopZTwkqqd4GQxjRxpm47POLBP9Mgp18ZmKkZXYenqgPjp0oxSCS67bldnjullDWviLOkxpz0Zfb0TToWJZqOpzTP7614umU3J3v7GoblklEpWtkZwUN9OigCBPHhyrX2UX6GXieOcD9sv62SJT4c4XT8SvNDX4K6salRUcqdr9AAwT2Rfk35NrgnWjqYJy0EpJ2XBXquRyQipKHgcYpp5N4Z1ip340CPA53nQFpxcROzYFkXh1LMRnnChIFCuOd0QZTx7OzTAormEptm7cgSk9EqB5m9HlWAb67bIO9aIF1udFKDy4fpsLpf1PE2WP7i4jMtCfLxG1kARcig9Bynt3ko2325oUNODLO8Z9LAaA6myxCy3TZryUS3QwEDxXljIjK7KVe15MahbaFEFNjzWp3A8OmlcNiqGF02xyJ59isNSZf51PGpJ4unwC0HNK3Eamd0ZPybMXX4Aq379ECXhh49nEORrMMQtlgWAMJvPrzPR7BV0nYgVBTtvaISN45RIICi9vd8fGDbOrd61VBj3GfJ5OXPRyE7FBR0f9wldSQy03gvlmR1di7tLR6wbkbPsHr7lCguyHop2gcypVqNvy55a6P3RcFdptmxPtKr4QzrFENNwznWPiaVhkodiO3UH0ygOyz1AcvBqybUQM1DsWXt5XH0sDu3sLkn9g37UwHO9g66Shm2jIo1DIfmOCJ2EHiVVGoM7dsgYhEWOhBxftYNPWEZA4eAhpYTSaT7IasRO8M2d6WS8qbtlvkwWdBP2cB6HbP3vrCTM7FvZdT4tRcmZRBxsikA9nPrp7aLAI4ccLsmCz7JXrA8p6MXHDEoDUnZnpR0DjUz4UB9534VeGRY66a0SUycQ2cibjcZrcMtGgir90Tme7fnIi8wvpw19BLElKLUb1bwLClfxiB0LuzZUvzROVA7ynozIWfuyEfICUDs2rQXUfPciodb692He1VyXGtv5sapvtoR3lhnzhTYe2ms1sPRLDibMoJE8lHyu4SvU6ZiSEFzSLN1aZwR5xPUjF3NKiia69G5Gn9AOONYFr5jMrJmY0uqW0TKK8GmkN3JLCjjMGs9K0sGbkU3YmTemMjeEka0mMGZsRum3biGJOKYDrzAoIQGpXHXw08F7EyxrPYRePIpqWueUx8MHEH0sEgRupxyNRPLxwGyzthyle3vuFg7ZxlMalHHFVrb0c6WRZIipCIvkcMcOQhm9l2Dt4ssmobzMq10PwLDLsuCBVyUApg25kihdbWa8290b1cac478542

2 Upvotes

1 comment sorted by

•

u/AutoModerator 1d ago

Thanks, /u/Empanti!

Please remember to review our rules. If your post is solved, be sure to reply with "Solved!" in the comments.

Keeping your post up after it's solved helps the community. Deleting solved posts may result in a ban.

We appreciate your contributions to r/ciphers.

I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.