Can you crack this multiple-shift cipher?

The below is the cipher that is to be cracked :

40 77 77 60 6b 6e 29 69 73 19 6b 69 75 6d 2f 29 67 30 7c 73 75 6e 75 2c 70 20 74 26 74 68 6b 6c 70 67 66 27 66 28 69 5e 27 7a 68 63 6b 82 27 29 28 -de


Need-to-know:

• -de is a termination character and is not part of the message.
• this ciphertext is in hexadecimal (base 16)
• ASCII values were used along with multiple shifts to derive the cipher-text.

Clues:

Clues are in descending order of how much they reveal. Read only till where necessary.

• A maximum of 8 shifts are possible which may or may not have unique values. The actual number of shifts used may or may not be lesser than 8, it depends on certain fixed rules.

• the exact shift to be used depends upon the position of the char.

• mathematical number-series are used along with position value to determine shift used.

• 6 such series are used, of which 2 concern shape, and two are some of the most popular.

• The two lesser known series are the Catalan number series and the Lucas number series.

• If none of the 6 series are satisfied, position is checked for odd/even.

• All six series are - Catalan , Fibonacci, Lucas, Pentagon, Hexagon, Prime, and if not odd/even.

• These series are checked one after the other, and if a match is found, the next is not checked.

• Finally, this is the C implementation of the methodology used to generate this cipher.

Note : This cipher text as well its C implementation have changed since this question was posted, however, the link to it still redirects to v2.0. It is currently at v3.0 , which you may look at here.

• 64 6d 27 69 71 7b 70 6b 69 63 26 67 63 6e 6c 34 22 76 6e 6b 79 1b 60 70 26 5d 7a 1c 74 62 67 75 7a 1c 5c 17 69 6e 6b 72 6b 74 27 5e 7a 7c 6b 6f 76 70 32 17 6f 75 26 64 7a 1c 74 6c 7a 22 45 -6f Aug 8, 2020 at 11:38

The plaintext is:

Attack at dawn, _(uknow-i'm-kidding)_ be reddy !!

Explanation

For each character, check if the 0-based index of this char within the ciphertext is part of the Catalan, Fibonacci, Lucas, Pentagonal, Hexagonal, or Prime numbers (in that exact order). If not, check if the index is even or odd. For each of these 8 groups a fixed shift within the ASCII range is defined. The shift values for these 8 can be thought of as the 'key'.

To break the cipher, I analyzed the ciphertext values for each group and tried out shifts that seem reasonable. For example, the start of the ciphertext "40 77 77 60 6b 6e 29 69 73 19 6b 69 75" heavily suggests that 0x29 and 0x19 are spaces, since the numbers are so low and a space is 0x20 in ASCII. Letter frequency and letter patterns (especially at "ATTACK") also came into play.

The shifts are:
Catalan: -3
Fibonacci: +1
Lucas: -8
Pentagon: +2
Hexagon: -9
Prime: +1
Even: -7
Odd: +7

• Brilliant ! I expected it to be broken, and your methodology is in line with my suspicions on its vulnerabilities , and so i'd like to ask you : 1) how long do you think it takes to do this ? 2) Is there a less 'brute-force' way ? 3) Did you do this by hand or through a programmed solution ? Aug 23, 2020 at 15:40
• Further, if one does not use spaces, or any repeating separation characters (i.e, uses -, =, ;, etc across to separate the words, would it still be trivially crackable ? Aug 23, 2020 at 15:42
• @APJo (Note: I'm not a cryptologist) 1) Well with a computer probably a few seconds. 2) I tried to minimize brute-force by the analysis. There are definitely optimizations, but I can't think of one right now. 3) Both. I used a program that takes the input and key to generate the output (also it does some analysis). Regarding the key, I did it "by hand" (= I interpeted the analysis myself and put a key into my program). 4) I guess it depends on the length of the ciphertext, but generally I would say yes. E.g. letter frequencies within groups are still there, which is a major weakness. Aug 23, 2020 at 15:51
• @APJo The above comment of course assumes that the attacker knows the encryption algorithm, but not the key. Aug 23, 2020 at 15:54
• Lukas, i believe that the algorithm must be secure even if it is public, so your assumptions are my given conditions. Aug 23, 2020 at 16:00