# Can a Vigenère cipher be solved if the alphabet is modified (custom)?

Let's say I have about a statistically good sample of characters of text that appear to be uniformly distributed, but the composition of the text is [A-Z], [a-z], [0-9], +, and / — constituting basically a base64 alphabet. To me, the more or less uniform distribution of the text suggests at least a polyalphabetic cipher, and possible a Vigenère.

As far as I've been able to find, there doesn't exist any Vigenère cipher program to decipher a base64 alphabet. As an amateur coder, I can see why, but firstly the biggest obstacle to creating the code is that the + and / and separated from the rest of the characters in the ASCII lookup table, so a rotation algorithm is not straightforward, like it is for just caps.

Would it be possible to create a custom code/algorithm to code and decode base64 text using the Vigenère method?

The barrier to coding it would be the order to place the alphabet— should it be lowercase, UPPERCASE, numbers, symbols— mapped in that order, or does it matter?

Does the ordering of the alphabet matter to using a Vigenère? Can the keyword be altered to decode the cipher text in a shuffled alphabet?

See, I actually have a lot of text that I suspect is base64 Vigenère, and I also have the key— but I just don't have an algorithm to decode it.

I should probably add that the amount of characters is in the thousands, so it would not be practical to decode it by hand.

• Yes, it can certainly be done. See e.g. this question for an example. Aug 24 '16 at 12:23

Basically, yes you can. To jump from alphabet to numbers without forgetting the + and / you can store the ASCII values in an array of 64 values.

Considering the order, it doesn't really matter as long as the cipher program and the decipher program use the same alphabet in the same order. You could use the ASCII order (symbol, numbers, uppercase, lowercase) or more probably the base64 order (uppercase,lowercase,number,symbol).

The list of the ascii values:

[43, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122]

• Thank you for your answer. As a second part of the same question - would it be possible to decipher the message if the Vigenere is deciphered using a different alphabet order than the one it was used to encode? Would it require a shift such as "7ey" instead of "key"? To offer a trivial example. Aug 22 '16 at 19:08
• For the classical Vigenere cipher, if your alphabet is not in the same order, no you can't decipher your message. The key should be modified but without knowing at all the order of the alphabet, you can't know what the new key will look like. It could be "7ey", or anything else composed of 3 char. Aug 23 '16 at 6:54
• @CayetanoGonçalves: It's possible to break a Vigenère cipher with a shuffled alphabet, but it's more difficult. Basically, instead of breaking $n$ simple Caesar shift ciphers in parallel (one for each key letter), you need to break $n$ generic substitution ciphers. Of course, since all the substitution alphabets are related by a simple shift, some effort and information can be reused. Actually, that sounds like a really nice exercise to try, once you already know how to break ordinary Vigenère and generic monoalphabetic substitution ciphers. Aug 24 '16 at 15:21
• @IlmariKaronen: My bad, I didn't think it that way. Aug 25 '16 at 6:36