Substitution cipherThe substitution cipher involves one piece of data being replaced with another. The data could be a letter. For example, in a message the letter a is replaced by the letter d, the letter b replaced by the letter e, the letter c replaced by the letter f, and so on. Each letter is replaced by the one three to the right of it in the alphabet. When letter x is reached it is transposed to the letter a. In effect the alphabet has been 'wrapped around'. The table below shows the arrangement of plaintext and ciphertext characters using a shift of three.
Using this cipher the word hello in plaintext would become khoor in ciphertext. This particular cipher, that involves a shift of three to the right, is known as the Caesar cipher after Julius Caesar who used it to communicate with his generals. The enciphering key Ke is said to equal 3 and the decrypting key Kd is said to equal -3. Or: Ke = 3 Kd = -3 Kd is -3 because to decipher a letter the third one on its left has to be substituted. For instance in khoor the letter third on the left of k is h. In other words 'going' to the right is a positive shift and 'going to the left' is negative. Deciphering is a reversal of the enciphering process. In an alphabet of 26 letters there are 25 possible shifts to the right, starting at 1 (a->b, b->c, etc.) and going through to 25 (a->z, b->a, etc.). The key space for this particular cipher method is said to be 25. This is a low number and it would be reasonably easy to crack such an encrypted message just by trying out various shifts until some intelligible text appears. In fact, a print out of all possible shifts could be generated in seconds using the right computer program. As a rule of thumb the greater the key space the harder a cipher is to crack. The keyspace could be increased by including capital letters (add on 26), punctuation symbols, numbers, spaces and other alphanumeric keyboard characters. Also, the letters in the English language appear at a particular frequency in any non-specialised passage of text. For instance, the letter t occurs much more frequently on average than the letter z. The graph below shows relative frequencies. As can be seen, e is the most common, followed by t, then a. The least common are q and z. The analysis of ciphertext in order to determine the original plaintext is called Frequency analysis. Again a computer program can use this knowledge of frequencies of letter occurrence to analyse ciphertext and come up with a pretty good estimation of the original plaintext. Plaintext encryption using a simple shift substitution system is quite predictable. It is possible to use Modulo arithmetic to make the shift system much more unpredictable and stronger. To learn more follow this link: modulo encryption There are broadly speaking two types of cryptography: Symmetric-key cryptography and Public-key cryptography. The sections below discuss them. Symmetric-key cryptographyThe substitution method above is an example of symmetric-key encryption because to use it the sender and receiver have to know the the encryption or decryption key (Ke or Kd), depending on who is sending and who is receiving. To quote this section of the Wikipedia page on encryption (edited): Symmetric-key cryptography refers to encryption methods in which both the sender and receiver share the same key (or, less commonly, in which their keys are different, but related in an easily computable way). This was the only kind of encryption publicly known until June 1976 when a paper on public-key encryption was published. The modern study of symmetric-key ciphers relates mainly to the study of block ciphers and stream ciphers and to their applications. Block ciphers take as input a block of plaintext and a key, and output a block of ciphertext of the same size. Since messages are almost always longer than a single block, some method of knitting together successive blocks is required. The Data Encryption Standard (DES) and the Advanced Encryption Standard (AES) are block cipher designs which have been designated cryptography standards by the US government. DES, especially its more secure triple-DES variant, is used across a wide range of applications, from ATM encryption to e-mail privacy and secure remote access. Many other block ciphers have been designed and released. Stream ciphers, in contrast to the 'block' type, create an arbitrarily long stream of key material, which is combined with the plaintext bit-by-bit or character-by-character. In a stream cipher, the output stream is created based on a hidden internal state which changes as the cipher operates. Cryptographic hash functions are a third type of cryptographic algorithm. They take a message of any length as input, and output a short, fixed length hash which can be used in (for example) a digital signature. For good hash functions, an attacker cannot find two messages that produce the same hash. MD5 and SHA-1 and SHA-2 are popular standards. SHA-1 outputs a 40 character string no matter what the length of input. For example the password aaaaaa encrypted using SHA-1 using the phpMyAdmin program becomes f7a9e24777ec23212c54d7a350bc5bea5477fdbb. SHA-1 is what is called a one way function. A value encrypted by it can not be decrypted as their is no known inverse function. The following text encrypted using SHA-1 produces the 40 character string 9093b444de8e236f492284b8fb6e0a9fc8cbfac1
Thus SHA-1 can be used to create a digital signature for any piece of text or file. The integrity of a downloaded file can be verified by encrypted it with the SHA-1 algorithm and comparing it with its digital signature.
|