How the Kryha Works


Home Page
The Kryha Home Page

The Principle Common to Both Versions

The Kryha, like most cipher machines, produces a substitution cipher of cryptographic units, which are usually letters (see the procedures chapter).

The basic principle of how the Kryha works is the shifting of two alphabets. One of the two alphabets is shifted before or after each letter is encrypted or decrypted. Plaintext letters are searched for in one of the alphabets, while ciphertext letters are contained in the other alphabet. Shifting the alphabets before or after the encryption operation is a conventional choice that must be shared by the communicating parties, as is the choice of the alphabet used to search for the plaintext letter or the ciphertext letter.

These two alphabets are arbitrary. They can be identical. In this case, they can, for example, be reversed relative to each other. The advantage is that the encryption and decryption operations are identical.

An alphabet can correspond to a direct alphabet (ABC...Z) or an alphabet in which the letters are jumbled (for example: KRCP...M). To facilitate key transmission, unordered alphabets can be constructed from a key phrase. For example, the key phrase: "To Be or not to be, that is the question" allows the construction of the following alphabet: TOBERNHAISQUCDFGJKLMPVWXYZ. Each letter of the key phrase is used only once, and the alphabet is completed using the letters that are not part of the key phrase. Note: in this case, the last letters are predictable.

Physically, we have a wheel rotating counterclockwise and containing one of the duplicate alphabets (a choice related to the shape of the machine, which must optimally accommodate the gears). Usually, the alphabet on the moving wheel contains the alphabet containing the encrypted letters. In contrast to this movable alphabet, there is a fixed alphabet that is usually chosen to contain the letters in plain text. The initial shift is made by manually turning the wheel containing the first alphabet. This initial position is located either by counting the shift or (usually) by indicating a correspondence between two letters (one from the movable wheel, the other from the fixed alphabet). Pressing a lever triggers the rotation of the wheel and thus a new shift is obtained. The driving force comes from a spiral spring. A crank is used to re-tension the spring.

Encryption Examples

1st Example: Typical use with a single random alphabet

Suppose the machine has been configured with the following alphabets:

      Movable alphabet: XHRISMDOLWAVBNKPCZUFJETYCQ
      Fixed alphabet  : ABCDEFGHIJKLMNOPQRSTUVWXYZ

Then we shift the movable alphabet, for example, by 6 positions. The letter J in the movable alphabet then corresponds to the letter A in the fixed alphabet. We obtain the following configuration visible through the machine window:

      JETYCQXHRISMDOLWAVBNKPCZUF
      ABCDEFGHIJKLMNOPQRSTUVWXYZ
Note: The initial shift is part of the external key. It can be zero, but in this case (and if it's systematic), it favors the superposition of messages and thus the enemy's work.

We want to encrypt the word HELLO. We choose to encrypt before turning the movable wheel (which contains the crypto alphabet).

The letter H gives the encrypted letter H.

Next, we press the advance button four times. We assume that the internal configuration generates the following shifts: 6, 10, 7, 10.

After the first shift (6), we obtain the following correspondence between the two alphabets:

      KPCZUFJETYCQXHRISMDOLWAVBN
      ABCDEFGHIJKLMNOPQRSTUVWXYZ
The letter E is encrypted with the letter U.

After the second shift (10):

      SMDOLWAVBNKPCZUFJETYCQXHRI
      ABCDEFGHIJKLMNOPQRSTUVWXYZ
The letter L is encrypted with the letter P.

After the third shift (7):

      YCQXHRISMDOLWAVBNKPCZUFJET
      ABCDEFGHIJKLMNOPQRSTUVWXYZ
The second letter L is encrypted with the letter L.

After the fourth (and final) shift (10):

      NKPCZUFJETYCQXHRISMDOLWAVB
      ABCDEFGHIJKLMNOPQRSTUVWXYZ

The letter O is encrypted with the letter H.

Finally, the word HELLO is encrypted with the cryptogram HUPLH.

Note: It has been stated that the internal wheel, which normally contains the cipher alphabet, rotates counterclockwise. It is important to understand that from the cryptanalyst's point of view, this cannot be known. Indeed, if the two alphabets are exchanged, the other alphabet appears to move clockwise.

2nd example: using two unordered alphabets

      Movable alphabet: HCTFIOPUVZEJRNXWMYGLQASKDB
      Fixed alphabet  : VZBYKDSAELXTQNFGUMWCHIPORJ
Here is the correspondence after the initial shift of 6 positions: The letter P of the movable alphabet is opposite the letter V of the fixed alphabet.
      QASKDBHCTFIOPUVZEJRNXWMYGL
      VZBYKDSAELXTQNFGUMWCHIPORJ
Then, we obtain the following correspondences after shifts 10, 7, 10, 3, 10:
      EJRNXWMYGLQASKDBHCTFIOPUVZ
      VZBYKDSAELXTQNFGUMWCHIPORJ

      FIOPUVZEJRNXWMYGLQASKDBHCT
      VZBYKDSAELXTQNFGUMWCHIPORJ

      LQASKDBHCTFIOPUVZEJRNXWMYG
      VZBYKDSAELXTQNFGUMWCHIPORJ

      MYGLQASKDBHCTFIOPUVZEJRNXW
      VZBYKDSAELXTQNFGUMWCHIPORJ

      PUVZEJRNXWMYGLQASKDBHCTFIO
      VZBYKDSAELXTQNFGUMWCHIPORJ
If we encrypt the word Hello, we can obtain several solutions depending on the conventions followed by the correspondents:
  1. We shift the alphabets after encryption: XGRTN
  2. We shift the alphabets before encryption: IJTBF
  3. We take choice a but we decrypt: SVUVG
  4. We take choice b but we decrypt: UAVYJ

3rd Example: We take alphabets that are inverse to each other

If we take reverse alphabets:

      Movable alphabet: JROPIHCWMUGFNQTXLEASDKYBZV
      Fixed alphabet  : VZBYKDSAELXTQNFGUMWCHIPORJ
We choose an initial shift of 0. Then, the machine generates a shift of 4. (with the chosen configuration):
      JROPIHCWMUGFNQTXLEASDKYBZV
      VZBYKDSAELXTQNFGUMWCHIPORJ

      YBZVJROPIHCWMUGFNQTXLEASDK
      VZBYKDSAELXTQNFGUMWCHIPORJ
If we encrypt the word OK, we obtain the cryptogram BJ. But if we encrypt BJ, we obtain OK. Encryption is equivalent to decryption.

Creating Shifts – Kryha Version 1

With each encryption or decryption operation, the machine shifts the movable alphabet counterclockwise relative to the fixed alphabet.

Shifts are created by the action of an encryption disk (or code wheel). This disk is removable and can be replaced with another. Communicators must use identical disks. Each code wheel is composed of a fixed number of sectors. Each sector contains a specific number of teeth.

The shifts generated by the machine do not directly correspond to the number of teeth in a code wheel's sectors. The machine adds an additional displacement of four positions.

In short, with each encryption operation, the code wheel advances one sector and shifts the movable alphabet by a number of letters equal to the number of teeth in the current sector plus four positions.

The shifts are cumulative. Thus, if the first shift moves the movable alphabet 7 positions and the second shift moves 5 positions, the total shift is 12 positions (7+5). The movable alphabet is on a wheel. Thus, after a shift of 26 positions, we are back at the starting point. We are therefore working in modulo 26.

The choice of the encoder wheel as well as the initial position of this wheel are part of the internal key. These elements must be known to the communicators.

Here are the offsets generated by the standard wheel composed of 17 sectors:

      Sector Number : 1, 2, 3, 4, 5, 6, 7, 8, 9,10,11,12,13,14,15,16,17
      Teeths        : 3, 2, 3, 1, 2, 3, 2, 4, 2, 6, 1, 2, 1, 3, 2, 1, 5
      Shifts (+4)   : 7, 6, 7, 5, 6, 7, 6, 8, 6,10, 5, 6, 5, 7, 6, 5, 9
Example : Consider the following cryptogram:
      XYICP NDEAM APDTR AXXPZ XHYRY
The decryption gives: THE COURT IS UNABLE ... Here are the alphabets:
      Static:   P L M J N H G I B A K E T C D . X S W V U R F O . Y
      Mobile:   J N F G H E A C B D W Y X Z V U R S T Q L O I M P K
Standard Wheel, initial position : 15. The alphabets are initially aligned.

Details :

      Sector:  15 16 17  1  2  3  4  5  6  7  8  9 10 11 12 13 14
      Shift :    6  5  9  7  6  7  5  6  7  6  8  6  10  5  6  5  7

      Crypto:  X  Y  I  C  P  N  D  E  A  M  A  P  D  T  R  A  X
      Plain :  T  H  E  C  O  U  R  T  I  S  U  N  A  B  L  E  T

Creating Offsets – Kryha Version 2

Version 2 of the Kryha has a universal encoding disk. It has holes around its periphery. Each hole contains a screw. If the screw is unscrewed, the hole no longer exists (it is filled by the screw). If the operator screws in a screw, the hole is real. Between each hole, there are a specific number of teeth. As you can see, the universal disk resembles one of the removable disks in version 1. However, depending on whether a screw is screwed in or not, a different number of sectors and therefore offsets are obtained. If you press the action button, the universal disk advances until a fixed rod locks into the next hole thanks to a spring that presses the rod against the disk. The disk advances until a hole is empty. The movable alphabet advances by the number of teeth present in the sectors delimited by two holes. When the lever is pressed again, the rod rises, allowing the disk to rotate to the next empty hole.

The holes (and therefore the sectors) are numbered. The number of the empty holes constitutes the most important element of the internal key. This configuration must be shared by the communicating parties.

The universal disk contains 52 sectors. Here is the number of teeth contained in each of them.

             4,3,4,3,3,3,4,3,4,4,3,3,
             3,3,4,4,3,3,4,3,3,4,3,3,
             4,3,3,4,4,4,3,3,4,3,3,3,
             4,3,4,3,3,4,5,3,3,3,3,4,
             3,3,4,5
If all the screws are screwed in, we have the maximum number of holes and consequently we have the maximum of possible sectors, that is to say 52.

1st Example

Assume the use of ordered alphabets (ABC...Z) and that the initial choosen hole is 25. It is also assumed that all holes are empty (So we have 52 sectors). Encrypting a sequence of A's (in encryption mode and with advancement before encryption) produces the following cryptogram:

     XTQNJ FBYVR OLIEB XURNI FCZWS PMIDZ WSPMJ FCYUR
     OLIEA XUQNK GDAWT QMIEB YUROL HEAXU QLIFC ZVSPL

2nd example

Given the following holes: 1, 3, 5, 7, 11, 13, 16, 18, 21, 22, 25, 27, 30, 32, 33, 35, 37, 38, 40, 41, 43, 45, 47, 49, 52

The initial hole is 11.

Given the following alphabets:

     Movable alphabet (crypto): TE?OYVAS?WGNKBIDUL-?FMCRHP 
     Fixed alphabet (plain)   : GXMYHCERBJFSOPANUDIZWTLQVK
Given the plain text next:
     THUS-IF-EVERY-PERSON-ON-EARTH-BUYS-THE-KRYHA-MACHINES-THEN-EACH-OF-
     THEM-CAN-OBTAIN—THE-INCONCEIVABLY-LARGE-NUMBER-OF-KEY-CHANGES-
     WITHOUT-TWO-PERSONS-EVER-HAVI...
We obtain the following cryptogram in decryption mode and with the advancement of the wheels performed AFTER encryption:
     GHEHK VAZPV QGPCZ VXZTF XDEWJ YGPIL
     WRMUB ZVRMY DCRTA XDAQZ CXDJX MNEVA
     LZXKD SUEFW AGSMP JGWAH NLFTF STIIL
     FVACD AFIEU IOTDI BJRSQ CHVVG AOIIA
     XWCAM LXMNF HZOTR QAOVA SRLHR XMDWS
     JZKMR UBAB
Here are the details of the beginning of the encryption:
     Holes: 1 . 3 . 5 . 7 . . .11 .13 . .16 .18 . .21 22
     Teeth:5 4 3 4 3 3 3 4 3 4 4 3+3 3+3+4 4+3 3+4+3 3
     Sum  :                        6 10 7 10 3
     Plain:                        T  H U  S -
     Crypto:                       G  H E  H K 

     Mobile (plain): TE?OYVAS?WGNKBIDUL-?FMCRHP  T => G  (initial position)
     Fixed (crypto): GXMYHCERBJFSOPANUDIZWTLQVK 

     FMCRHPTE?OYVAS?WGNKBIDUL-? (after shift of 6) 
     GXMYHCERBJFSOPANUDIZWTLQVK H => H 

     GNKBIDUL-?FMCRHPTE?OYVAS?W (after shift of 10) 
     GXMYHCERBJFSOPANUDIZWTLQVK U => E
Note: To position the machine to the initial hole, the action button must be pressed until the desired position is obtained. Consequently, the initial position can only correspond to one hole.

To summarize, here are the elements that make up the key

The internal key

  1. Choosing the sector value (from which the various possible offsets are derived).
    1. In the case of the Kryha V1, the sectors are not directly configurable; they are a fixed part of the encoder wheel and the machine. However, multiple encoder wheels can be used. In this case, you will need to tell the correspondent which one you are using. Note: If the correspondents purchased the basic model without options, they only have the standard 17-sector wheel.
    2. Choosing the holes position in the case of the Kryha V2
  2. Choosing the two alphabets

The external key

  1. The initial position of the encoder wheel, which is made up of the different sectors from which the offsets are derived. In the case of kryha V2, you choose the initial hole.
  2. The initial position of the movable alphabet
  3. Whether or not to advance the movable alphabet before encryption
  4. The choice of the alphabet used to read plaintext or ciphertext.
Note: The inner key, which takes longer to set up, is usually stored in a key table valid for a given period. The extern key is usually changed for each message. If this is the case, this extern key is transmitted via an indicator group that is part of the transmitted cryptogram.

The Kryha Period

The Kryha v1

The period corresponds to the number of sectors multiplied by the number of cryptographic units. Thus, the period is equal to 17 x 26 if we use the standard disk. Therefore, after 442 characters, we end up with not only the same offset but also the same cipher alphabet.

Note: Caution! The encoder wheel must allow a total number of moves that must be prime with the size of the alphabet (26). In the case of the standard wheel, there are a total of 111 steps.

The Kryha V2

There are a maximum of 52 sectors, so the period is (at most) 52 x 26 = 1352 characters.

Note: Most often, the number of sectors is between 20 and 30.