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.

  • $\begingroup$ Yes, it can certainly be done. See e.g. this question for an example. $\endgroup$ Commented Aug 24, 2016 at 12:23

1 Answer 1


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]
  • $\begingroup$ 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. $\endgroup$ Commented Aug 22, 2016 at 19:08
  • 1
    $\begingroup$ 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. $\endgroup$
    – Damien
    Commented Aug 23, 2016 at 6:54
  • 2
    $\begingroup$ @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. $\endgroup$ Commented Aug 24, 2016 at 15:21
  • $\begingroup$ @IlmariKaronen: My bad, I didn't think it that way. $\endgroup$
    – Damien
    Commented Aug 25, 2016 at 6:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.