[ARG] The Pizza Code Mystery


#5586

Nice to see something that appears to be concrete! I don’t recall ever seeing that text before.

I suppose you take the code and decrypt or encrypt with ARC4 and then do the opposite with Twofish.

Still leaves us with needing two keys. ARC4 with 40-2048 bits and Twofish with 128 to 256 bits.


#5587

The first message is new to you all, but I posted the second one pretty much as soon as it happened. It’s here if you want to see the whole thing—near the bottom: http://thepizzaisalie.wikia.com/wiki/Stormseeker


#5588

Well, sadly, my cryptography skills are minimal. Plaintext goes in, ciphertext comes out, or vice versa. I have only a vague sense of nonces, salts, etc.

That said - I can certainly code-monkey up a Python script for everyone’s testing pleasure. In fact, here it is:

https://pastebin.com/zsaDNQLX

Usage:

pizza_arg.py ciphertext_file arc4_key_file twofish_key_file

The filename parameters specify:

(1) A binary file containing a ciphertext;
(2) A text file containing an ARC4 key; and
(3) A text file containing a Twofish key.

It decodes the ciphertext first the ARC4 key and then with the Twofish key and outputs the result.

Some test code is included to demonstrate that it works:

> pizza_arg.py test_arc4
Testing arcfour:
Original plaintext: The quick brown fox jumped over the lazy dogs.
Ciphertext:]]B]ke
                 ??·?6?	A?=?Pn8??T)????>?~)\?E??*
Plaintext: The quick brown fox jumped over the lazy dogs.

> pizza_arg.py test_twofish
Testing twofish:
Original plaintext: The quick brown fox jumped over the lazy dogs.
Ciphertext:??~?h3KD́C?K
                      ?	
                        ??????7??8?Y2?j???A?Ru????u\`
Plaintext: The quick brown fox jumped over the lazy dogs.

> pizza_arg.py test_files
Twofish encode: ??~?h3KD́C?K
                           ?	
                                ??????7??8?Y2?j???A?Ru????u\`
ARC4 encode:     ??F?D-$??U??-???mνi?????]hiF?'x?̱V%?A?<?Xh
Wrote test files.

> pizza_arg.py test_ciphertext test_arc4_key test_twofish_key
ARC4 decode: ??~?h3KD́C?K
                        ?	
                                ??????7??8?Y2?j???A?Ru????u\`
Twofish decode: The quick brown fox jumped over the lazy dogs.  

So there you go. Both key files get strip()ped of whitespace, so just bang them into a text file. The only mildly tricky part will be encoding whatever input you want to test as binary data, but that should be relatively trivial.


#5589

Awesome! Can this theoretically take multiple keys in the same file for each, or only one key at a time?


#5590

One key at a time, but I wrote it the way I did figuring that it would be extremely easy to script for brute-forcing. You can shell-script a bunch of calls to it, or you can modify the main function to iterate however you want.

(edit) For instance, you could replace the entire main code with this:

if __name__ == '__main__':
    arc4_keys = []; twofish_keys = []
    with codecs.open('arc4_keys', 'r', 'utf-8') as f:
        arc4_keys = list(x.strip() for x in f.readlines())
    with codecs.open('twofish_keys', 'r', 'utf-8') as f:
        twofish_keys = list(x.strip() for x in f.readlines())
    ciphertext = open('ciphertext', 'rb').read()
    for a in arc4_keys:
        for t in twofish_keys:
            try:
                plaintext = decode_twofish(decode_arc4(ciphertext, a), str(t))
                print a + ' + ' + t + ' --> ' + str(plaintext)
            except Exception as e:
                print 'Decoding with ' + a + ' + ' + t + ' failed: ' + str(e)

Save all of your ARC4 keys in arc4_keys (one per line, separated by carriage returns), and all of your Twofish keys in twofish_keys (same), and put the input in ‘ciphertext’ - it will bang through every key combination and print the result. Combinations that throw an exception, if there are any, will display the exception message.


#5591

Thanks for doing that! I’ll think of a bunch of keys on top of what I posted before and give it a shot.

EDIT: I updated the wiki with this latest turn of events, and I’ve also added a page called “Possible Keys” to help us work together and determine which keys we have already utilized. I’ve yet to employ your scripting, @sfsdfd, as I am at work, but when I get home I’m going to take a look and give it a whirl. I’m assuming I can just download it and follow the included instructions to run it, correct? Do I need a compiler or any additional software, or are the needed libraries included on that page with the scripting?

Anyhow, now that we have the scripting, we can avoid using online tools that may or may not work.

I think we are close to solving this, and at the very least a bit closer than we were!


#5592

Added a 256 bit key to try.


#5593

I’m thinking it may now be a good idea to take what is related to the TwoFish and RC4 message and remove it from the equation, and hopefully what we have left behind will guide us towards the keys and the IV/mode we need for the 2F encryption.

I don’t think it’s going to be as simple as BenallohPaillier, although the extra “l” in that makes it 16 bytes, which was either a hint as to what the key is, or may just be a hint at the key size. Remember, Storm did add an extra L to it to make it 16 bytes, so that fact is definitely important.

He stated in the message that it may be given in a “less than obvious way,” which I take to mean that we may have to infer it, unlike the previous SECOM key which was actually written down. Then again, he did say the solution was “visible,” although, as we now know, that could just mean that the methodology was visible, not so much the keys.

Now, pretty much everything in that “Handy info” list could work as a key, so that’s at least a start. Anyone who is comfortable analyzing ciphertext may have an easier time of giving just the 2F decryption a go, and analyzing the result. I imagine the result that needs the RC4 would be a little easier to spot patterns with, seeing as it’s a stream cipher.

Anyhow, just some thoughts for now. I will be giving the scripting a go here in a few, assuming I can figure out how to implement it.


#5594

I’m assuming I can just download it and follow the included instructions to run it, correct? Do I need a compiler or any additional software, or are the needed libraries included on that page with the scripting?

Yep. Here’s what you need:

  • Python 2.7. It’s preinstalled in macOS and you can download it for Windows.

  • Pip. Ships wtih Python 2.7.9. If you don’t have that version, this guide will help.

  • Two non-standard libraries: Crypto and Twofish. Both are available via pip, and I’ve included install instructions. Literally a one-line terminal command installs both (presuming you have pip intalled).

Let me know if you run into problems, either with getting the script to run or with the logic of the script. I have a bit of time to spare tonight.


#5595

You rock, thanks again! I’ll reach back out if I have any luck, folks!


#5596

Would it be worth moving some of the discussion to the existing discord server?

Might make discussion a bit quicker and more iterative

Also, MACROSCALEQUANTUMSYSTEMS is 192 bits which would work as a twofish key


#5597

Okay, so I apologize for my ignorance–I think I’m getting close, though!

I have Python 3.7.1 installed, and every version after 3.4 comes with pip by default. I’ve pasted your entire code into a text file that I converted to “pizza_arg.py.” I also have the hex code converted to binary saved into a text document, and I have the keys files you mentioned before saved into their own documents. I’m assuming the carriage return is ‘\n’ although I’ve only got one key in there for now:

image

I know I’ve done something wrong, because this is what I keep getting when I type “python pizza_arg.py”:

image

Any thoughts as to how I can correct it? I do apologize, and thank you for your patience–I’ve never used Python, although it does look somewhat simple to use once you learn it. Thanks for any help you can provide, you’ve been a godsend!

Oh, and as an added note, I did replace the main code in the original pastebin file with the one you included in your second response, because I’m hoping I can just keep adding multiple keys.


#5598

Looks like you’re running inside the interpreter already, if you quit the python interpreter with quit(), then run python pizza_arg.py that should work


#5600

AGH! I did not mean to delete that–here’s the post again (I’m on fire today :stuck_out_tongue:)

Okay, I tried from a straight cmd window and tried with just “pizza_arg.py” in a new Python window, and I’m still getting it:

image

I’m sorry, I’m really a scrub at this. Normally I’m inside another program already, like C# with Unity or Excel with VBA. I appreciate your patience!

We can move to the Discord BTW, which I’m in–I don’t have permissions to post, however.

I need a nap, lol.


#5601

You’re still in the interpreter, Gunsrequiem. See the >>> ? You’re not talking to cmd.exe - you’re talking directly to Python.

Do this:

quit()
python pizza_arg.py ciphertext_file arc4_keys twofish_keys

That will skip the immediate-mode interpreter and just ask Python to run the script with your parameters.

To answer your question above about carriage returns: The script just breaks the text files into newline-delimited strings, and strip()s them of all whitespace before and after. So it shouldn’t matter at all if your text files are \n or \r\n or \r\r\n or whatever, or even if you have extraneous spaces or tabs before or after the keys - strip() removes all whitespace.


#5602

Ah, yes, the issue was I hadn’t added the path to environment variables (thanks to Snalty for the assist there). I’m getting somewhere with it now–I’m actually getting a return! I’m still getting a syntax error, but it’s showing up the way you advised it would, so I think I’m okay despite the error:

image

Thank you so much! Can’t wait to add some more keys to this bad boy!

Haha, oh wait, that’s printing the line with the error. I’ll see if I can fix it on my end.


#5603

Ah - you’re right, we’re getting somewhere!

I know exactly what’s going wrong with that syntax error. I wrote the script for Python 2.7 (again, macOS-standard, and kind of a known quantity), but apparently you’re running it in Python 3.

One of the primary differences is that Python 2.7 uses this syntax:

print '123' + my_var + '456'

…and Python 3 uses this syntax:

print('123' + my_var + '456')

If that seems stupid, it’s because it is, kind of. You can fix it by sticking parens around all of the print statements. Yeah, that’s literally it.

Try it and lmk.


#5604

Yep, that did the trick! Just finishing the install of the two libraries now, and we’ll see what we get! Thanks a million!

Snalty and I have been trying to get it to run, but each time we try to install “pycrypto” we get this:

image

And when running the code it spits out this error:

image

Oy! That’s really hard to see–it says it can’t find “module Crypto”

Sorry to continue being a bother, sfsdfd–any thoughts as to why this may be happening? Were you able to get it running on your end? Maybe we should just try with 2.7 and do everything from scratch the way you had it implemented?


#5605

Tonight’s interaction is a textbook example of a saying from a friend of mine:

With software design, the first 90% of the project takes 90% of the time, and the last 10% of the project takes 90% of the time.

Happy to help out, but I’m not sure how helpful I can be if it’s just saying that it is encountering an “error” while installing pycrypto. Of course, it makes perfect sense that if the install failed, then running the script that depends on it also won’t work.

This may well be a Python 2.7 vs. Python 3 issue. I’m not surprised if the set of available libraries is different for each version.

There are two ways we can skin this proverbial cat. If you can install Python 2.7, your problems may be solved. (On the other hand, you may encounter some namespace issues with running 2.7 and 3 side-by-side, as in: which pip goes with which version?) Alternatively, I can redesign the script to run in Python 3.

Let’s go down both paths and see who reaches the end first. Deal? I’ll throw a bit of time into the script rewrite.


#5606

I went ahead an uninstalled the 3 version, installed the 2.7.13 version, downloaded pip (I thought it might come with it since it was 2.7.9 or later, but for some reason it wasn’t recognizing pip syntax), and tried again to download pycrypto–I read something that said pycrypto is no longer supported, and may create issues, and there’s a new one called pyrcryptodome, but it doesn’t seem to support TwoFish. Anyhow, I gave pyrcrypto a shot anyway, and still got the same error.

When I did “pip uninstall Crypto” and “pip uninstall pycrypto” to try the install again, it couldn’t find either, which seems to suggest that it never downloaded in the first place?

Anyway, I’ve uninstalled everything, and I’m ready to give it another shot if you’re able to get it to work on your end. If it works for you, then theoretically it should work for me, too. Are you using a MAC? Maybe having it integrated with the OS makes a difference? I don’t know much about it, but maybe it’s something that can be fixed? Or possibly I can run your script in an online environment instead?