Published on

Kautilyan Cipher

Authors

I was watching a youtube video on Kautilya's Arthashastra few days back. It's a treatise on statecraft, military strategy and more. Interestingly, it had an entire section on the secret service of its times. The spies were trained to use coded language to transmit information.

AI generated ancient indian espionage

AI generated image of ancient Indian espionage

Though we are not completely sure, retellings of history suggest there existed a cipher named after Kautilya.

Vatsyana, mentions about this art from known as Mlecchita Vikalpa, the art of writing words in a peculiar way or in cipher.

In a modern cryptography curriculum, we often start with reading about Caesar cipher. It is a substitution cipher in which each letter of the plaintext is shifted a certain number of places down or up the alphabet.

Caesar Cipher from caesarcipher.net

Caesar Cipher from caesarcipher.net

Unlike Caesar cipher which is a shift cipher, Kautilyan cipher is a monoalphabetic substitution cipher. In monoalphabetic ciphers each letter in the plaintext is mapped to a fixed letter in the ciphertext

The original cipher would have been written in a version of Brahmi script which I am not familiar with. So I ended up using two of its descendants

  • Eastern Nagari (popular in Eastern India) or Bengali-Assamese script - shortened to BA henceforth.
  • Devanagari (popular in Northern and Western India) - shortened to DN henceforth.

Kautilya Substitution Tables

Original (BA/DN/IAST)Substitution (BA/DN/IAST)
অ / अ (a)খ / ख (kha)
আ / आ (ā)গ / ग (ga)
ই / इ (i)ঘ / घ (gha)
ঈ / ई (ī)ণ / ण (ṇa)
উ / उ (u)চ / च (ca)
ঊ / ऊ (ū)জ / ज (ja)
ঋ / ऋ (ṛ)ণ / ण (ṇa)
ঌ / ऌ (ḷ)থ / थ (tha)
ঌ* / ॡ (ḹ)ড / ड (ḍa)
এ / ए (e)ঢ / ढ (ḍha)
ঐ / ऐ (ai)ন / न (na)
ও / ओ (o)থ / थ (tha)
ঔ / औ (au)ড / ड (ḍa)
ম / म (ma)দ / द (da)
হ / ह (ha)ন / न (na)
ণ / ण (ṇa)ফ / फ (pha)
শ / श (śa)ব / ब (ba)
ষ / ष (ṣa)ভ / भ (bha)
স / स (sa)ম / म (ma)
ই / इ (i)য / य (ya)
র / र (ra)র / र (ra)
ল / ल (la)ল / ल (la)
উ / उ (u)ব / व (va)

* has no corresponding letter

If you observe the table, you will notice that vowels, anusvara and the spirants are interchanged for the consonants and the conjunct consonants. The cipher is a reversable cipher, in other words, the replacement alphabets can be used interchangeably.

I felt a sudden itch to code this up. The following form allows any text in BA or DN scripts and encrypts it using the Kautilyan cipher.

Output will appear here

To make it harder to decrypt, the spies would often memorize the substitution tables and would recall the substitution to only the entrusted few. Using some benchmark sentences, its not diffucult to recreate the substitution table and break the cipher.

Reference