do you know any methods for choosing specific position in text for a key?

Background: Lets suppose, that I want to encode message to friend: Text1 (not too long - max 1000 chars). I have made publicly available string of 1000 random characters before (RandomText). Now I want to encode my Text1 in this way:

1) Take part of message (e.g. 10 characters)
2) select key from RandomText (at specified position)
3) encode (it does not matter what is the algorithm)
4) process another part of message with next key.

After encoding I have 100 parts encoded with 100 keys.

My question is - are there any known methods (e.g. ever used in history) for selecting specified positions in point 2)?

e.g. the simplest would be:

nextKeyPosition = previousKeyPosition + someConstant


nextKeyPosition = previousKeyPosition + someConstant + someFunction(previousEncodedText)

or anything else.

  • $\begingroup$ You'd have to define what properties you want from the method before one can be recommended. What is the security goal of choosing several keys in the first place? $\endgroup$
    – otus
    Jul 19, 2016 at 9:20
  • 1
    $\begingroup$ Are you limited to one-time-pads or pen-and-paper ciphers? If you have a computer, the answer is clearly none of these. $\endgroup$ Jul 19, 2016 at 9:20
  • $\begingroup$ it is pen-and-paper cipher. My friend told about solution like this one: the RandomText could be a book - then each word is encoded with next word from book - we start at e.g. chapter 11 word number 11 and get first word from string to be encoded and encode with first word from book, second word from string with second key from book ... and so on. He told me that he thinks that such ciphers were used during WWII $\endgroup$
    – oen
    Jul 19, 2016 at 9:36
  • $\begingroup$ The difference is that we do not have a book here but simmilar solution could be with random text. $\endgroup$
    – oen
    Jul 19, 2016 at 9:39
  • $\begingroup$ @otus - several keys - just to make it more difficult to decode. If I use one key then I think that it will be easy to break such cipher (I forgot to mention that it is pen-paper cipher). $\endgroup$
    – oen
    Jul 19, 2016 at 9:40

1 Answer 1


My question is - are there any known methods (e.g. ever used in history) for selecting specified positions in point 2)?

Your construction is quite similar to the Running Key Cipher, which is soemtimes considered a variant of the Vigenere cipher. There they just start at one position and use all subsequent symbols as keystream.

... He told me that he thinks that such ciphers were used during WWII

As far as I know, in WWII rotor machines were the primary way to encrypt in WWII, including the well-known Enigma. By that time, classical ciphers were pretty much out of fashion already, because e.g. the Friedmann test (see link to Vigenere cipher) was invented in the 1920s, and frequency analysis has been known since the 9th century. So no, by that time encryption schemes had passed that stage already, although surely some people were still using it. Just like today some people use ciphers, which are known to be broken.

But considering the security of your scheme: If you use a keystream from a book, frenquency analysis will break that. Using e.g. only every 50th word from a book does not help, you are still linked to the characteristics of a language. If you use truly random keystreams, you are only on the safe side as long as that keystream is unknown to the attacker. If you publish those strings somewhere on the internet, you are relying on the attacker not knowing that.

The main aspect about classical ciphers in a pen-and-paper scenario is that you can actually do it without spending hours and hours for encrypting/decrypting short messages. Contrary to popular opinion, adding complexity does not automatically add security. But pretty much always it adds effort for the regular encryption and decyption. Therefore, I would suggest using one of the usual classical ciphers instead of trying to invent something new. E.g. the Vigenere cipher with long keywords (such that the message is maybe just 3-5 times the length of the keyword) works quite well, since frequency analysis doesn't work very well if there are very few letters corresponding to each letter in the keyword.

And a final note: If you assume the attacker uses a computer, classical ciphers offer basically zero security.

  • $\begingroup$ thx. for answer, the Running Key with indicator block seems something interesting for me. $\endgroup$
    – oen
    Jul 19, 2016 at 12:05
  • $\begingroup$ Classical ciphers were actually used a lot as field ciphers in WWII (and later), because even the best electromechanical cipher machines of the time were big, heavy, expensive, conspicuous and just generally not something you'd want to lug around if you were, say, trying to spy on somebody. Something like a Playfair variant or a book cipher was much easier to transport and conceal on one's person, and was generally believed to (and often enough did) offer sufficient resistance to contemporary cryptanalytic methods. $\endgroup$ Aug 18, 2016 at 22:12

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.