Posted in Science & Nature

Cryptography: Book Cipher

So far, the three ciphers introduced could all easily be cracked using frequency analysis and the Kasiski examination. Is there a cipher that is easy to implement yet difficult to break for a beginner cryptanalyst? An extremely popular and surprisingly powerful cipher is the book cipher. Essentially, the book cipher replaces a keyword with an entire book. Instead of replacing a letter for a letter or symbol in a systematic and mathematical way (such as a set shift number or using a tabula recta), the book cipher replaces letters for numbers that refer to a certain text within a book. As the only way to decode the message is to have the book, it is an extremely secure way of enciphering a message given that both parties have an identical copy of the book.

There are many variations of the book cipher. The most popular type is giving a page number, with the first letter of the page being the plaintext. A variant of this is giving a set of three numbers for every letter: the page number, the line number and the word number (or just two: page and line, then take the first letter). Ironically, this may be less secure at times as it may reveal that it is a book cipher. However, doing this for each letter makes the enciphering and deciphering process incredibly long and arduous.

A shortcut method is to refer to a word within a page (using the three-number set coordinates method described above) to shorten the ciphertext. Although this method is much easier in practice, it poses the challenge of finding a book that includes all the words in the plaintext, which may be difficult if the code is for military or espionage purposes.

Because of this, and the fact that both parties (or everyone in the ring) need identical versions of the book while not standing out too much, the most common books used are the dictionary (typically a famous version such as the Oxford Dictionary) or the bible (again, a standard version is used). These books are not only good because they incorporate a massive vocabulary, but they are also inconspicuous while being carried around in an enemy territory.

The book cipher is a very difficult code to crack for most people without advanced cryptanalysis training. Thus, the easiest way to crack is to deduce what book is the keytext. There are numerous ways to do this, but one way would be to cross-match the books of two known spies until common books are found. In the setting of spies in a foreign country, a book such as a traveller’s guide or phrasebook dictionary can be considered a likely target as it can be carried around easily while containing many words. Ergo, the secret behind cracking the book cipher is less about cryptography and more about using the science of deduction.

Posted in Science & Nature

Cryptography: Kasiski Examination

The Kasiski examination can be used to attack polyalphabetic substitution ciphers such as the Vigenère cipher, revealing the keyword that was used to encrypt the message. Before this method was devised by Friedrick Kasiski in 1863, the Vigenère cipher was considered “indecipherable” as there was no simple way to figure out the encryption unless the keyword was known. But with the Kasiski examination, even the Vigenère cipher is not safe anymore.

The Kasiski examination is based on the fact that assuming the number of letters of the keyword is n, every nth column is encoded in the same shift as each other. Simply put, every nth column can be treated as a single monoalphabetic substitution cipher that can be broken with frequency analysis. Ergo, all the cryptanalyst needs to do to convert the Vigenère cipher into a Caesar cipher is know the length of the keyword.

To find the length of the keyword, look for a string of repeated text in the ciphertext (make sure it is longer than three letters). The distance between two equal repeated strings is likely to be a multiple of the length of the keyword. The distance is defined as the number of characters starting from the last letter of the first set of strings to the last letter of the second set of strings (e.g. “abcdefxyzxyzxyzabcdef” -> “abcdef” is repeated” -> distance is “xyzxyzxyzabcdef” which is 15 letters). The reason this works is that if there is a repeated string in the plaintext and the distance between these strings is a multiple of the keyword length, the keyword letters will line up and there will be repeated strings in the ciphertext also. If the distance is not a multiple of the keyword length, even if there is a repeated string of letters in the plaintext, the ciphertext will be completely different as the keyword would not match up and be different.

It is useful recording the distance between each set of repeated strings to find the greatest common factor. The number that factors the most into all of these distances (e.g. 6 is a factor of 6, 12, 18…) is most likely the length of the keyword. Once the length of the keyword is found, then every nth letter must have been encrypted using the same letter of the keyword. Thus, by recording every nth letter in one string, you can obtain what is essentially a Caesar cipher. The Caesar cipher is then attacked using frequency analysis. Once a few of these strings (of different positions on the ciphertext) are solved, the keyword can be revealed by checking the shift key against a tabula recta (e.g. if a certain string of nth letters is found to have been shifted 3 letters each, then the corresponding letter in the keyword must be “D”, which shifts every plaintext letter by 3 in the Vigenère cipher). When the keyword is deduced, every message encrypted using that keyword can now easily be decoded by you.

Although the Kasiski examination appears to be complex, attempting to try it reveals how simple the process is. Thus, it is useful to try encrypting a message using the Vigenère cipher then trying to work out the keyword using the Kasiski examination. Much like the frequency analysis, it is an extremely useful tool in the case of needing to break a secret code.

Posted in Science & Nature

Cryptography: Vigenere Cipher

It has thus been proven that the Caesar cipher, the pigpen cipher and any substitution cipher can be simply broken using frequency analysis. The basis for this is that each letter or symbol can only represent a single letter, meaning that letter frequencies (e, t, a, o…) are directly translated onto the cipher language. Ergo, by making each letter represent more than one letter, the letter frequencies can be masked and an additional level of security can be added to the cipher. This is called polyalphabetic substitution and it is the basis for a type of cipher known as the Vigenère cipher.

The cipher was first conceived in 1553 by Giovan Battista Bellaso and has been improved since. It is famous for being rather simple to use despite the difficult to decipher it at a beginner’s level. This trait earned the cipher the nickname “le chiffre indéchiffrable”, which is French for “the indecipherable cipher”.

The Vigenère cipher can be thought of a stack of Caesar ciphers (essentially a cipher within a cipher), where each letter is shifted by a variable key (in a normal Caesar shift, every letter is shifted by the same key). This is achieved by the implementation of a keyword and a table called a tabula recta. A tabula recta is simply a grid made from 26 rows of the alphabet, each row of which is made by shifting the previous one to the left. This table essentially shows all the possible outcomes of a Caesar shift.

Now, let us try encoding a message using the Vigenère cipher. The message “attack at dawn” is encoded using the keyword “nothing”. Ideally, there should be no repeating letters in the keyword for the sake of security. Therefore, if there are any repeating letters, just remove the repeated letters (e.g. “crocodile” -> “crodile”). First, repeat the keyword until it matches the number of letters of the message (e.g. “attackatdawn” is aligned with “nothingnothi”). Then, use the tabula recta to encrypt the message. The rule of thumb is “key-row, message-column”, meaning that the row of the tabula recta starting with the letter of the key is matched against the column starting with the respective letter of the message. To take the first letter as an example, the key letter is “n” and the message letter is “a”. The letter corresponding to where the “n” row and “a” column meets is “N”. If this rule is followed for each letter, the encrypted message becomes: “NHMHKXGGRTDV”. Although it takes some effort to find each letter on the table, the message becomes “indecipherable” to a beginner cryptanalyst as frequency analysis becomes useless. For example, the repeating letter “H” can represent either “t” or “a”. The longer the keyword is, the more secure the Vigenère cipher becomes.

However, the Vigenère cipher is not indecipherable. Next, we will look at a cryptanalysis method called the Kasiski examination that attacks a polyalphabetic cipher such as the Vigenère cipher to gain access to the keyword.

Posted in Science & Nature

Cryptography: Pigpen Cipher

Another well-known substitution cipher is the “pigpen cipher” or “Freemason’s cipher”. As the name suggests, it was often used by Freemasons to encrypt their messages. However, as time has passed, it has become so well-known that it is not a very secure cipher at all.

The pigpen cipher does not substitute the letter for another letter, but instead uses a symbol that is derived from a grid-shaped key. The key is made of two 3×3 grids (#)(one without dots, one with dots) and two 2×2 grids (X)(one without dots, one with dots). The letters are filled in systematically so that each shape represents a certain letter (e.g. v=s, >=t, <=u, ^=v)

The cipher has many variations that attempt to throw off an attacker by rearranging the order of the grids or the letters. Thus, even if a cunning attacker picks up on the fact that the cipher is a pigpen cipher, they may use the wrong key and get a completely wrong message. Nonetheless, it is a useful skill to recognise the unique symbols of the pigpen cipher as it is a popular cipher used commonly in puzzles.

As with any substitution ciphers, frequency analysis and pattern recognition is the key to cracking the pigpen cipher.

Posted in Psychology & Medicine

Identity

Do you want to gain trust and build intimacy with someone? That is easy – all you have to do is recognise and accept their identity. Every person tries to define who they are by building an identity or their “self”. This identity includes their personality, experiences, philosophies and interests. If you wish to have a deep and meaningful conversation, start off with a light conversation to explore the person’s identity. What kinds of films do they like? What leisure activities do they enjoy in their free time? What occupation are they in? If you slowly learn such superficial information, an outline of their identity begins to take place. Also, observe the person’s attitude as they speak and how they respond to certain topics. You will be able to know or at least guess what their interests are.

As the person slowly becomes fond of you through conversation, simply lead the conversation towards their interests that you found out. The person will talk excitedly about their interests. Now, respond accordingly with a smile and a look of interest (better if you are actually interested). A positive conversation has been established. Steer the conversation so that the other person talks as much as possible about their “self”. The person will think that you share their interests, and nothing is as attractive as common interests.

Shall we go one step deeper? Interests give an outline and begin to add colour to the identity, but to recognise their identity as a whole you must gather more specific data. Once a sense of trust and intimacy begins to develop, the conversation can develop into a more personal one. Talk about the person’s past, their philosophies, their dreams, hopes and aspirations. The more intimate information they share with you, the deeper the intimacy becomes and the more you learn about their identity. The important point here is that you not only learn about their identity, but acknowledge it every step of the way. The greatest gesture you can make to another person is accepting them for who they are. If you talk with someone that understands you and accepts you, you will talk as if time does not matter and share your deepest secrets.

On the other hand, if you wish to attack an enemy psychologically, what could you do? As you might have guessed, you should attack their identity. Pull out all of their weaknesses and faults and attack them, while logically disproving their fundamental beliefs and philosophies. Systematically pull apart their psyche and destroy the pride they have for their identity and even the strongest enemy will fall to their knees.

Posted in Philosophy

Politics

The following is an excerpt from the Analects by Confucius, titled The Secret of Politics:

Confucius’ disciple Zi-gong asked him: “What is politics?”
Confucius replied: “The key to politics is to make food plentiful(足食), keep enough soldiers(足兵) and earn the people’s trust(民信).”

Zi-gong thought about this, but decided it was too hard to do all three. He asked again: “If you had to give up one, which would you choose?”
Confucius replied: “I would give up the soldiers.”

Zi-gong asked again: “If you had to give up one more thing, which would you choose?”
Confucius thought for a minute and said: “I would give up food. If you believe, you can withstand hunger for a while and withstand the hardships of war, but if you lose trust you will immediately lose everything.”

The character 信 stands for trust, which is believing in another person. Of course there must be trust among the people, but Confucius teaches us that the trust between the people and their leaders is the most important. In fact, with trust and faith you can overcome anything. If you can respect and trust in your leaders, you can endure hunger and at times, even summon the strength to defeat your enemies with your bare hands.

An administration that has lost the hearts of the people will fail.

Posted in Life & Happiness

Carriage

There was a disciple who bought an expensive carriage. He did not want to damage it and so never took it out and instead cleaned it every day. One day, his master visited his house and saw his disciple polishing the carriage. He asked:
“Who owns this carriage?”
“I do.”
“It appears to me that the carriage owns you.”
“…What do you mean, master?”
“Are you not treating the carriage as a servant serves its master?”
“…”
“What you do not enjoy cannot be called your possession. Only by enjoying it do you possess it. Not only objects, but the warm sunshine, fresh air, beautiful scenery are all a man’s possessions if he enjoys them. A person who can enjoy many things can be called truly rich. If a person enjoys the world, even without a single penny they are the wealthiest person in the world.”

The foolish disciple was proud of his carriage that he spent so much money on, when he could not even use it. The way people treat the learning of knowledge and skills is similar to how the disciple treated the carriage. People look for all kinds of luxurious carriages that they will not, or cannot even use.

What is infinitely better is to enjoy and indulge in the carriage you already own to move forward in your life, no matter how cheap and ragged it may be. In fact, believing that your carriage is old and worn-out is simply a delusion. Within the most basic carriage lies the secret to enlightenment. However, those who are blinded by delusion that they must seek a fancier, stronger-looking carriage that requires less effort can never see that. The Bluebird of Happiness that you have been seeking forever has been waiting inside you all this time. But how can you learn the ultimate secret if you do not even think about looking deep within your heart?

There is a world of difference between possession and enjoyment. Do not seek the talents of others, cultivate and develop the talents you already own. To be satisfied with what you have and enjoying it – that is the secret to happiness.

Posted in Life & Happiness

Happiness

Happiness is:

Finding a pencil that’s been chewed,
Telling the time, learning to whistle,
Tying your shoe, for the very first time,
Playing the drums, in your own school band.

Happiness is:

Two kinds of ice cream, pizza with sausage,
A warm blanket, a warm puppy,
Knowing a secret,
Walking hand in hand.

Happiness is:

Climbing a tree, five different crayons,
Catching a firefly, and setting him free,
Being alone every now and then,
Coming home again.

Happiness is:

Having a sister,
Sharing a sandwich, getting along,
Singing together when day is through,
Those who sing with you.

Happiness is:

Morning and Evening,
Daytime and nighttime,
Anyone, and anything at all,
That is loved by you.

~ Paraphrased from Peanuts by Charles M. Schulz

Posted in History & Literature

En Passant

In chess, there are three special moves: castling, pawn promotion and en passant. The first two are quite well known, but the third is less recognised by amateurs and is more of a “secret move” for more experienced players. Thus, many beginners complain their opponent is cheating, when they are using a perfectly legal move.

En passant is French for in passing – the etymology becomes clear once one understands how the move works.
Although a pawn can usually only move one space forwards, it can move up to two spaces on its first move. En passant only applies to a pawn that has moved two spaces. For example, if a white pawn moves two spaces forward and a black pawn is positioned to its left or right, the black pawn can move diagonally behind the white pawn to take it. This is because if the white pawn had moved one space, it would have been in the normal attacking range of the black pawn. Ergo, en passant is a technique that can stop a pawn from penetrating the defensive line and charging forwards.

This move must be used the turn after the pawn moves two spaces. Otherwise, the right to en passant disappears (i.e. cannot wait a turn to use it). In chess, this is the only move where the attacking piece lands on a space other than the taken piece.

Why was the en passant created? The reason being, the two-space first move rule came into place around then, so the en passant was devised to balance it, while complementing the pawn’s short attack range and inability to move backwards.

(Sourcehttp://verlassen232.deviantart.com/art/en-passant-184741920?q=boost%3Apopular%20en%20passant%20chess&qo=8)