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 Psychology & Medicine


Among the thousands of signs and symptoms in the field of medicine, there is one that every doctor and medical student knows since the development of medicine. Clubbing is an easily noticeable sign in a patient’s fingers that can have wide implications on their health.

Clubbing is essentially when the angle (gap) between the fingernail bed and finger disappears. The formal definition is much more complicated, such as “the loss of the normal <165° angle, or Lovibond angle between the nailbed and the fold”, but for all intents and purposes the simple definition is sufficient.

To see if a patient has clubbing, the physician carefully studies the fingers against light. There are a few ways to check for clubbing but the most popular methods are holding the fingers out straight and holding them parallel to the ground, checking the angle between the nailbed and finger, or the Schamroth’s window test. The latter test is done by holding two opposing fingers (such as the left and right index fingers) against each other nail to nail. The fingers are then held against the light so that the light can shine through the “window” that is made. If the window is not seen, the test is positive and the patient has clubbing.

What does clubbing suggest? Clubbing was first noticed by Hippocrates, the father of Western medicine, who observed that people with clubbing tended to grab their chest and fall dead. This is one of the most common associations to clubbing – a congenital cyanotic heart defect such as tetralogy of Fallot or patent ductus arteriosus. Other common associations are related to the lungs, such as lung cancer (one of the most common causes) and various other lung diseases such as interstitial lung disease, tuberculosis and other chronic infections. There are also a myriad of other diseases associated to clubbing, including but not limited to: Crohn’s disease, ulcerative colitis, cirrhosis, celiac disease, Graves disease and certain types of cancers (lung, gastrointestinal and Hodgkin’s lymphoma mainly). Clubbing can also be idiopathic, where there is no apparent cause for the clubbing and the person just has it (possibly just born with it).

Despite knowing about clubbing for over 2000 years, we still do not know the exact reasons for clubbing. There are theories that it is related to a fall in blood oxygen content leading to vasodilation in the peripheries. As the pathophysiology is not clear and so many diseases are associated with it, when clubbing is found in the patient the physician should investigate the related organ systems (heart, lungs, GI mainly) to narrow down the possible cause of it. As many of the causes (such as lung cancer) carry a rather morbid prognosis, it is quite important to notice whether the patient has clubbing when doing a physical examination.

Posted in Psychology & Medicine


Blood, which supplies all the cells in the human body with nutrients and oxygen, flows through the vessels due to the pumping of the heart. Thus, blood flow directly transmits the force generated by every heartbeat. As the blood ejected by the heart causes the arteries to “pulse” by stretching and relaxing. As some pulses can be felt over the skin, they are very useful in patient examinations, especially a clinical exam of the cardiovascular system. Although people commonly know how to take a pulse from the wrist or neck, there are many more places a pulse can be taken from.

  • Radial pulse: Taken from the inside of the wrist on the side of the thumb.
  • Brachial pulse: Taken from the inside of the elbow.
  • Carotid pulse: Taken from where the neck meets the jawline, or 2~3cm either side of the Adam’s apple to be precise.
  • Apex beat: This measures the heartbeats directly, taken on the left chest between the 4th and 6th ribs (around the left nipple).
  • Abdominal pulse: Taken from above the belly button of a lying patient, may be able to see the pulse.
  • Femoral pulse: Taken from the middle of the groin. 
  • Popliteal pulse: Taken from the inside of the knee.
  • Posterior tibial pulse: Taken from the inside of the ankle behind the bone.
  • Dorsalis pedis pulse: Taken from the back (upper side) of the foot along the middle.

When taking a pulse, you use your second and third fingers (and the fourth if you want) and press lightly on the pulse point. If you press too hard, you may stop the blood flow and obliterate the pulse. As a pulse is measured per-minute, it is often taken for 10 or 15 seconds and multiplied by 6 or 4 respectively. Also, it should be noted whether the pulse has a regular rhythm, and if it is irregular, whether it is regularly irregular or irregularly irregular. If the pulse is over 100 beats per minute, it is called tachycardia, while less than 60 beats per minute is referred to as bradycardia. If it is irregular, it is called an arrhythmia.

An experienced doctor can diagnose different conditions such as an aortic stenosis or atrial fibrillation just from taking the pulse of the patient. Taking a pulse is also a crucial diagnostic tool in traditional Korean and Chinese medicine.


Posted in History & Literature

Pope Joan

There is a legend in papal history regarding a certain Pope John VIII, who is believed to have reigned between 853 – 855 AD. The reason this pope is so famous is that legends state that “he” was in fact a woman, making her the first (and only) female pope in history.
Legend has it that she was a very talented and intelligent woman who, with the help of disguising herself as a man as education was forbidden to females in those times, quickly rose in the church hierarchy to eventually become the pope. After a couple years of power, her true sex was discovered when she gave birth to a child one day.

There is reasonable evidence of her existence, ironically through the extensive cover up of her existence by the church. After finding out that she was a woman, history tried its best to forget the fact by constantly removing evidence of her existence. For example, in the 14th century a series of busts of past popes were made for the Duomo of Siena, one of which was named “Johannes VIII, Foemina de Anglia”, suggesting a female pope by the name of John VIII.

It is possible that she managed to deceive people of her gender by having a form of adrenal hyperplasia, which would lead to her having abnormally high levels of androgen during development. This would lead to ambiguous secondary sex characteristics, such as facial hair, androgynous appearance and possibly even an ambiguous genitalia (but of course she would have had a mild form as she was able to conceive and birth a child).

Pope Joan had a significant impact in papal traditions. Two which are famous are the change in the papal procession path and the sedia stercorania. 
The childbirth scene that exposed her occurred during a papal procession, whilst passing a narrow lane. That lane is no longer passed after that event occurred.
The sedia stercorania is a chair with a hole in it that was used to install new popes. The reason for the hole was so that a junior cardinal could reach below the chair on which the pope was sitting on, and check whether he had testicles, after which he would announce: “Duos habet et bene pendentes” (he has testicles and is well hung). This became a compulsory examination after the scandal of Pope Joan.