Friday, October 19, 2007

Magic Cube of order 3

Magic square of order n is a nXn matrix having same sum of all rows and coloums.
Eg.








It is a magic square of order three. Sum of all the rows and columns is 15.

Now the question is, can we make a magic cube of order three with same sum of all the faces and same sum of all the rows and columns of all the faces.

Here also method to make the magic cube is more important than just finding the answer by hit and trial.

Thanks,
Agry

Wednesday, October 3, 2007

The Code Book by Simon Singh - Chronology

In continuation to previous blog, this one describes the evolution of various encryption techniques mentioned in the book. This goes back to the time of Julius Caesar. Initially when encryption was not widely used, people used to employ Steganography, which is to hide the message by writing it in invisible ink ("milk" of the thithymallus) plant could be used as an invisible ink. Although transparent after drying, gentle heating chars the ink and turns it brown. Many organic fluids behave in a similar way, because they are rich in carbon and therefore char easily. Another method was to write on the shell of a egg by a solution of alum and vinegar and then message can be retrieved from albumen. Cryptography itself can be divided into two branches, known as transposition and substitution.



In transposition, the letters of the message are simply rearranged, effectively generating an anagram. For example: Spartan scytale, which is a wooden staff around which a strip of leather or parchment is wound. The sender writes the message along the length of the scytale, and then unwinds the strip, which now appears to carry a list of random letters; only by rewinding the strip around another scytale of the correct diameter will the message reappear.



In substitution cipher each letter in the plaintext is substituted for a different letter, thus acting in a complementary way to the transposition cipher. In transposition each letter retains its identity but changes its position, whereas in substitution each letter changes its identity but retains its position. The first documented use of a substitution cipher for military purposes appears in Julius Caesar's Gallic Wars. One of the earliest descriptions of encryption by substitution appears in the Kama-Sutra, a text written in the fourth century A.D. by the Brahmin scholar Vatsyayana, but based on manuscripts dating back to the fourth century B.C. The Kama-Sutra recommends that women should study 64 arts, such as cooking, dressing, massage and the preparation of perfumes. The list also includes some less obvious arts, namely conjuring, chess, bookbinding and carpentry. Number 45 on the list is “mkcchita-vikalpd”, the art of secret writing, advocated in order to help women conceal the details of their liaisons.



To encrypt a plaintext message, the sender passes it through an encryption algorithm. The algorithm is a general system for encryption, and needs to be specified exactly by selecting a key. Applying the key and algorithm together to a plaintext generates the encrypted message, or ciphertext. The ciphertext may be intercepted by an enemy while it is being transmitted to the receiver, but the enemy should not be able to decipher the message. However, the receiver, who knows both the key and the algorithm used by the sender, is able to turn the ciphertext back into the plaintext message.



Following are the major advancements done in the field of cryptography:





  1. Caesar shift or Cipher of Queen Mary of Scott

  2. Vigenere Cipher(Le chiffe’re Indechifferable)

  3. Enigma

  4. Alien Language or Linear B

  5. Public Key Cryptography

  6. RSA and PGP

  7. Quantum Computers



Caesar cipher or Caesar Shift



This one is supposed to be the first documented encryption method used by mankind. As the name suggests, it was discovered by Julius Caesar, when he needed to send a war message to Cicero, who was on the verge of surrendering.


In this cipher each letter of the plaintext is shifted to certain number of places relative to its position in normal alphabetical order. For example: “I Love You” becomes “L Oryh Bry” with a shift of 3.Frequency analysis is applied to break this cipher. This method was devised by Al-kind, around 7th century. Main drawback with frequency analysis was that it depends entirely on pattern generated for a particular type of literature. For example "From Zanzibar to Zambia and Zaire, ozone zones make zebras run zany zigzags." Or like French author Georges Perec who wrote a 200 page novel, “La Disparition”, without using letter ‘e’.



But how Queen Mary scott got associated with the cipher? There is a interesting story behind this, which you can read in the book itself, however I have mentioned her name because she was, sadly, the first one who lost her life due to cryptanalysis.


Vigenere Cipher



This cryptic system was first invented by Leon Battista Alberti in 15th century. He is probably best known as an architect, having designed Rome's first Trevi Fountain and having written De re aedificatoria, the first printed book on architecture, but unfortunately he didn’t get the credit for this. People came to know of this system by Blaise de Vigenere, a French diplomat born in 1523. In the Vigenere cipher a different row of the Vigenere Square (a different cipher alphabet) is used to encrypt different fetters of the message. In other words, the sender might encrypt the first letter according to row 5, the second according to row 14, the third according to row 21, and so on. To unscramble the message, the intended receiver needs to know which row of the Vigenere Square has been used to encipher each letter, so there must be an agreed system of switching between rows. This is achieved by using a keyword. The strength of the Vigenere cipher lies in its using not one, but 26 distinct cipher alphabets to encrypt a message. The first step in en-cipherment is to draw up a so-called Vigenere square, as shown in pic., a plaintext alphabet followed by 26 cipher alphabets, each shifted by one letter with respect to the previous alphabet. Hence, row 1 represents a cipher alphabet with a Caesar shift of 1, which means that it could be used to implement a Caesar shift cipher in which every letter of the plaintext is replaced by the letter one place further on in the alphabet. Similarly, row 2 represents a cipher alphabet with a Caesar shift 2, and so on. To unscramble the message, the intended receiver needs to know which row of the Vigenere Square has been used to encipher each letter, so there must be an agreed system of switching between rows. This is achieved by using a keyword. As well as being invulnerable to frequency analysis, the Vigenere cipher has an enormous number of keys. The sender and receiver can agree on any word in the dictionary, any combination of words, or even fabricate words.



The most intriguing figure in nineteenth-century cryptanalysis is Charles Babbage, the eccentric British genius best known for developing the blueprint for the modern computer. His inventions include the speedometer and the cowcatcher, a device that could be fixed to the front of steam locomotives to clear cattle from railway tracks. In terms of scientific breakthroughs, he was the first to realize that the width of a tree ring depended on that year's weather, and he deduced that it was possible to determine past climates by studying ancient trees. In 1823 Babbage designed "Difference Engine No. 1," a magnificent calculator consisting of 25,000 precision parts. After ten years of toil, he abandoned "Difference Engine No. 1," cooked up an entirely new design, and set to work building "Difference Engine No. 2." Lack of government funding meant that Babbage never completed Difference Engine No. 2. The scientific tragedy was that Babbage's machine would have been a stepping-stone to the Analytical Engine, which would have been programmable. In fact, the Analytical Engine provided the template for modern computers. The design included a "store" (memory) and a "mill" (processor), which would allow it to make decisions and repeat instructions, which are equivalent, to the "if . . . then . . ." and "loop" commands in modern programming. In his own lifetime, Babbage made an equally important contribution to code breaking: he succeeded in breaking the Vigenere cipher, and in so doing he made the greatest breakthrough in cryptanalysis since the invention of frequency analysis. Babbage's work required no mechanical calculations or complex computations. Instead, he employed nothing more than sheer cunning.



Babbage's successful cryptanalysis of the Vigenere cipher was probably achieved in 1854, soon after his spat with Thwaites, but his discovery went completely unrecognized because he never published it. The discovery came to light only in the twentieth century, when scholars examined Babbage's extensive notes.



Another interesting story associated with Vigenere Cipher is of Beale Cipher, which made cryptanalysis really famous and people devoted their entire lives in order to break it. Till date it hasn’t been deciphered, at least officially.




Enigma



Around 1890, Marconi invented Radio, one of the most important inventions of mankind. After the invention of radio, reliable encryption became a necessity. If the enemy were going to be able to intercept every radio message, then cryptographers had to find a way of preventing them from deciphering these messages. When World War broke out in 1914, German cryptos found a device to encrypt their messages, called Enigma, made by German inventor Arthur Scherbius and his close friend Richard Ritter.


Scherbius's Enigma machine consisted of a number of ingenious components, which he combined into a formidable and intricate cipher machine. However, if we break the machine down into its constituent parts and rebuild it in stages, then its underlying principles will become apparent. The basic form of Scherbius's invention consists of three elements connected by wires: a keyboard for inputting each plaintext letter, a scrambling unit that encrypts each plaintext letter into a corresponding ciphertext letter, and a display board onsisting of various lamps for indicating the ciphertext letter. An operator wishes to send a secret message. Before encryption begins, the operator must first rotate the scramblers to a particular starting position. The initial setting of the scramblers will determine how the message is encrypted, i.e. it acts as a key. The initial settings are usually dictated by a code-book, which lists the key for each day, and which is available to everybody within the communications network. Distributing the code-book requires time and effort, but because only one key per day is required, it could be arranged for a codebook containing 28 keys to be sent out just once every four weeks. Once the scramblers have been set according to the codebook's daily requirement, the sender can begin encrypting. He types in the first letter of the message, sees which letter is illuminated on the lampboard, and notes it down as the first letter of the ciphertext. Then, the first scrambler having automatically stepped on by one place, the sender inputs the second letter of the message, and so on. Once he has generated the complete ciphertext, he hands it to a radio operator who transmits it to the intended receiver. In order to decipher the message, the receiver needs to have another Enigma machine and a copy of the codebook that contains the initial scrambler settings for that day. He sets up the machine according to the book, types in the ciphertext letter by letter, and the lampboard indicates the plaintext.



Weakness of Enigma were its code-book and key patterns, devised by its operator. Nobody was able to break Enigma by the end of WWI. With the help of Hans-Thilo Schmidt, a traitor in German Army, allies came to know the working of Enigma. Although they now had the machine but they were still too far away from breaking the cipher, as Enigma cipher didn’t depend upon the machine, but the initial scrambler setting. In due course of time, it was finally broken and it all started with Biuro Szyfrow, a polish mathematician. Rejewski's strategy for attacking Enigma focused on the fact that repetition is the enemy of security: repetition leads to patterns, and crypt-analysts thrive on patterns. The most obvious repetition in the Enigma encryption was the message key, which was enciphered twice at the beginning of very message. If the operator chose the message key ULJ, then he would encrypt it twice so that ULJ ULJ might be enciphered as PEFNWZ, which he would then send at the start before the actual message. The Germans had demanded this repetition in order to avoid mistakes caused by radio interference or operator error. But they did not foresee that this would jeopardize the security of the machine. Rejewski proceeded as follows. Thanks to Hans-Thilo Schmidt's espionage, he had access to replica Enigma machines. His team began the laborious chore of checking each of 105,456 scrambler settings, and cataloguing the chain lengths that were generated by each one. It took an entire year to complete the catalogue, but once the Biuro had accumulated the data, Rejewski could finally begin to unravel the Enigma cipher. Each day, he would look at the encrypted message keys, the first six letters of all the intercepted messages, and use the information to build his table of relationships. Rejewski could now go to his catalogue, which contained every scrambler setting indexed according to the sort of chains it would generate. Having found the catalogue entry that contained the right number of chains with the appropriate number of links in each one, he immediately knew the scrambler settings for that particular day key. The chains were effectively fingerprints, the evidence that betrayed the initial scrambler arrangement and orientations. Rejewski was working just like a detective who might find a fingerprint at the scene of a crime, and then use a database to match it to a suspect. Within a year following Rejewski's breakthrough, German communications became transparent. Rejewski's skills eventually reached their limit in December 1938, when German cryptographers increased Enigma's security.



Enigma operators were all given two new scramblers, so that the scrambler arrangement might involve any three of the five available scramblers. After this Polish general offered the British and French two spare Enigma replicas thinking that perhaps Britain and France, with their extra resources, could fully exploit the concept of the bombe, which infact they did, thanks to Alan Turing, one of the British Cryptanalyst.



Alien Language or Linear B



It was not much of a concept rather it was innovative thinking. Americans used a different language for their communications, used by one of their tribes, named Navajo. As for Linear B goes, it was an ancient language, used by people of Mycenae, around 2000 B.C., but it took ages to get it deciphered.




à Mishra

My Shelfari Bookshelf

Shelfari: Book reviews on your book blog