P. 1
Document 4

Document 4

4.67

|Views: 200|Likes:
Published by api-3734530

More info:

Published by: api-3734530 on Oct 15, 2008
Copyright:Attribution Non-commercial

Availability:

Read on Scribd mobile: iPhone, iPad and Android.
download as DOC, PDF, TXT or read online from Scribd
See more
See less

03/18/2014

pdf

text

original

Cryptology And Communication

INTRODUCTION : In today’s Knowledge Age, information transmission become part and parcel of our lives. In this scenario , computer networks holds pride of a Place. Now, as millions of ordinary citizens are using networks for banking, shopping, and filing their tax returns, network security is looming in the horizon as potentially massive problem. Hence this project aims at providing a modest solution to the problem using “Cryptology”. This project titled, ” Cryptology And Communication ”, employs efficient algorithms such as Data Encryption Standard(DES)to tackle the problem of network security. The project contains two parts viz., COMMUNICATION and CRYPTOLOGY. The communication part demonstrates that two or more computers can be linked together like a mini LAN. One computer was called SERVER and the other two its terminals or nodes. The source code was split into two .One exclusively for sending and receiving data (data can be files or messages) over the communication channel. This program is meant only for the nodes. The second program must be executed on a central computer, which was referred as FILE SERVER. A user working on the terminal can place a file in the server or get the file from the server. Some of the features offered in the COMMUNICATION part are:  File transfer can be done in both directions i.e. server to the node and node to the server, operating at the terminal.  Facility to send urgent messages from node to the server had been provided.  The users can share printer. The users working on the nodes can utilize a printer connected to the server.

Dept of C S E, Narayana Engineering College , Nellore

1

Cryptology And Communication

 Directory service of the server had been provided to the users working on different nodes. This helps in locating files on the file server.  More than two computers can be connected, i.e. two computers are connected to the server to demonstrate the ability and the server can access both the nodes.  For providing greater security while transmitting, for each character, an acknowledgement was sent back to the transmitter.  For better security, each character was encrypted and the transmitted over the line. On reaching the destination, it was decrypted back to the original form. This process is similar to the function of presentation layer of a LAN.

The other part, CRYPTOLOGY, demonstrates how the message in plain natural language called plaintext can be enciphered and again deciphered back to the plaintext. Many famous algorithms or ciphering techniques such as CAESAR CIPHER, NIHILIST TRANSPOSITION, VIGNERE CIPHER, UNIT TRANSPOSITION, GRONSFELD CIPHER, BEAUFORT CIPHER,VARIANT BEAUFORT,KNIGHT’S TOUR etc …. had been implemented successfully as one integrated package. The enciphering process scrambles the bits so thoroughly that a person wanting the information is unlikely to be able to unscramble them.

Dept of C S E, Narayana Engineering College , Nellore

2

Cryptology And Communication

ANALYSIS :

The concept of cryptography has great importance. right from the days of kings people want to communicate without being recognized. To acheive that they used to change the text into unreadable or un intelligible form. The well recorded strategy is followed by ceaser who used to transfer data in encrypted form. in his method he used to replace every character by the character three places next to it in the alphabet, there by making it unreadable During the second world war this concept played pivotal role the germans invented enigma machine, the Japanese purple .the allied forces had the great difficulty in decoding the actual text. Finally turing cracked the code and discovered the machine bomb which can decrypt the message .this led to the allied victory but the methods used for encryption are old they used rotors and machines to do that. with the advent of computer and the whole task is being done with the computer The art of secret writing is not new today, It dates back to thousand of years. The content of this chapter describes general terms most often used in the field of “cryptology”. The moment you connect your computer to any other computer, whether by Local Area Network with coworkers or by a dial-up connection to an internet provider, you subject yourself to some risk that your data could be compromised. Your data could be stolen or destroyed. Your communications could be intercepted or misdirected. The security of internet host sites is nebulous at best. Eventually all of them will face some sort of break-in. it might be a hacker trying to prove that he or she can gain unauthorized access to an internet site, or it might be a malicious attempt to destroy data. Being forewarned is your best defense against your data

Dept of C S E, Narayana Engineering College , Nellore

3

Cryptology And Communication

being corrupted or used in unauthorized fashion. One of the ways in which you can ensure the privacy of your data is by cryptography.

2.1 : Problem Specification
T he

word cryptography is the art and science of secret writing “cracking” or “breaking” cryptic communication

and communication, embracing all kinds including codes and signaling . Cryptanalysis is the art of messages called ciphers to which one doesn’t have a key. The term here generally includes all kinds of hidden communication, but this project restricts it to the sense of breaking written communications or cryptograms. Cryptology deals almost exclusively with letters and words, and can include such secret communication as those involving the telephone, facsimile and certain aspects of television. The science of cryptology also deals with deciding whether or not a given message is worth cracking. As for the turn cryptology, it has come to signify the science that includes unspecified aspects of cryptography and cryptanalysis, and the work involved in rendering a particular communication system secure. The later embraces both preventing unauthorized message-handling and intercepting messages from stations whose cryptologists has the responsibility to prevent interceptors from obtaining what from his point of view is secret and private. The term cipher implies a method, or system, of secret writing which is unlimited in scope; it should be possible, using any one given cipher, to transform any plaintext (a message in common language), regardless of its length and the language in which it is written, into a cryptogram, or single enciphered message. The process of accomplishing this transformation is called encipherment; the opposite process to that of transforming cryptograms into a plaintext is called decipherment.

Dept of C S E, Narayana Engineering College , Nellore

4

Cryptology And Communication

The word decrypt which is borrowed from modern French and Italian writers with its various derivatives is being used to signify the process of solving and reading cryptogram without any previous knowledge as to their keys, or secret formulas. Thus the word deciphers conveys only one meaning as mentioned above the mechanical process of applying a known key. A key is a word, and becomes a keyword. If more than one word is serially involved in the key to a cipher, it remains keyword, though it can be called as key phrase. If numerals constitute the key, the term becomes numerical key or simply keyword. A keyword sets the pattern of a cipher, and may not necessarily be a plaintext word.

Passive Intruder Just Listens

Intruder

Active Intruder Can alter Messages Decryption Method

Plain Text

Encryption Method Encryption key, k Ciphertext

Decryption Key

Dept of C S E, Narayana Engineering College , Nellore

5

Cryptology And Communication

2.2 : System Requirements
Software Requirements: Language used Operating System : C,VC++ : Windows 98 .

Hardware Requirements : Processor RAM Hard disk : Pentium - III or above. : 128MB. : 10GB

Dept of C S E, Narayana Engineering College , Nellore

6

Cryptology And Communication

DESIGN :

3.1 : Different Ciphering Techniques The prime aim of this chapter is to describe in detail about various ciphering techniques that are derived out of a few famous algorithms and are used in this project. These algorithms are many in number but only few had been successfully implemented in this project. Ciphering algorithms are classified as follows. ♦ Concealment ciphering ♦ Transposition ciphering ♦ Substitution ciphering ♦ Other techniques. The word diagram is being used to indicate a two-letters sequence: similarly there are trigrams, tetragrams, pentagrams etc, to indicate sequence of three, four, five, etc., letters. Ciphers, in general, fall into three major classifications: 1. Concealment cipher, 2. Transposition cipher , and 3. Substitution cipher. Minor types, such as “abbreviation “, are sometimes used, though these

have never seemed to be truly of a cryptographic nature.In concealment cipher, which is not often seen in popular literature, the true letters of the secret message are hidden, by any device and this type of cipher is intended to pass without being suspected as the conveyor of a secret communication.

Dept of C S E, Narayana Engineering College , Nellore

7

Cryptology And Communication

In transportation cipher, the true letters of the secret message are taken out of their text-order, and are rearranged or “scrambled” according to the key pattern. In substitution cipher, the original letters are replaced with substitutes or cipher-symbols, and these symbols are arranged in the same order as their originals. Popular, hobby type cryptograms usually leave word spacing and punctuation in place, and eliminate all cipher alphabet patterns that cause any letter to equal the same letter in the standard alphabets. These cryptograms are called “ aristocrats”. Word spacing and punctuation is “dead give always” to the experienced analysts. Hence to make a cipher just a bit more secure it can be reduced to five or six letter code groups, eliminating original word spacing and punctuation. In this context, cipher text is referred to as code groups when its letters are spaced five or six letters to a group. A code system is more cumbersome than a cipher system, since the code book (or the key) that must necessarily be provided contains a long list of words, phrases or sentences. A single number can stand for one or more words as

DECIPHERMENT SECTION Vocabulary Armored car Leave no evidence Careful Come; London Meet me Code 125 600 428 312 967

ENCIPHERMENT SECTION Code 414 392 967 998 125 Vocabulary Horse About Meet me Fly is in the web Armored car

A code book can be quite bulky, and must be always guarded carefully. A pair of code books with symbols arranged at random would afford a high degree of secrecy. This type of effort for producing secret code is referred to as encoding and reducing them to the plain text is called decoding. Even though, they offer the highest degree of secrecy the code book becomes worthless if comprised without the knowledge of the parties in communication. 1. CONCEALMENT CIPHERING:
Dept of C S E, Narayana Engineering College , Nellore 8

Cryptology And Communication

It is the oldest known secret writing method in which cipher text seems to be like a plain message. It is difficult to suspect that it is conveyer of a secret communication. The oldest application is found in the ancient device of writing the secret message on the Shaved head of the slave, and dispatching the slave after his growing hair had covered the message. Another device is some what more practical: The secret message is written on a wooden tablet, then covered with wax coating, and second message is written on the top.In the Middle Ages, the development over concealment writing called puncture cipher was used. This was very famous in England, and was used to avoid the payment of postage. This puncture cipher was practiced by simply punching holes with pintos that these letters when read in regular order would convey desired information. Concealment cipher is known by various names such as NULL cipher, OPEN LETTER cipher, CONVENTIONAL WRITING, DISSIMILATED WRITING and so the name NULL cipher means that the cryptograph has a great portion of letters null or insignificant letters and only a few truly significant letters convey the meaning. For example, the message: To those friends considering, it is always news but all filled ciphers disturb happiness with varied answer, give the concealed meaning THIS IS A NULL CIPHER. This is obtained by reading a first letter in first word, second letter in second word, and so on. There are many other ways. For instance: inspect details for Trigleth-acknowledge the bonds from fewer can be written down in rows as shown below. I N SP E C T DE FO TR AC TH BO F R F E TA I L S R IGL E T H KNOW L EDGE E NDS OM WE L L

From this the decryptor can find out that the third column gives the secret message, STRIKE NOW.

Dept of C S E, Narayana Engineering College , Nellore

9

Cryptology And Communication

If column give no results, diagonals can be checked or a zigzag line between first column and other can be inspected.

2. TRANSPOSITION CIPHERING: A method of producing cipher text from a plain text in which the letters are disarranged from their natural order according to a particular pattern or key is called transposition ciphering. These ciphering techniques basically follow two types: regular and irregular. The regular type is further subdivided into two categories: geometrical & symmetrical. The geometric type is also called complete unit transposition – is based on small unit or cycle repeated over again and again .If the plain text message is not evenly divisible into units, it is usually extended by the addition of extra characters called nulls. Some of the keys are geometrical figures such as triangle, diamond etc. Following is the example with a unit consisting of letters and geometrical figure used is cross. The cryptograms are usually grouped into five letter units before transmission by cable or radio. A B D C E F : : : : H G I J L K M N P O

Plaintext Cryptogram (a) Cryptogram (b) Cryptogram (c)

ABCDEFGHIJKLMNOP. ADBCE HFGIL JKMPN O. ACBDE GFHIK JLMON P. ADEHI LMPBC FGJKN O.

If the message is for instance ABCDE, the above figure gives many simple ways in which a plaintext can be enciphered by transposition of letters. In cryptogram (a) and (b) the letters of a unit are still together whereas in cryptogram (c), the letters of one unit has been mixed with letters of another unit. The decrypted message can be obtained by transpositioning in opposite way.

Dept of C S E, Narayana Engineering College , Nellore

10

Cryptology And Communication

Another most popular geometrical figures used for transposition ciphering appear as square, with or without series of numbers 1to25, 1 to 36 etc. Two widely known examples of using a square are magic square and knightstour. The magic square is a square in which row, column, diagonal adds up to a unique number called magic number. Magic square with odd number of rows can be easily generated using Loubere’s method, which does not work for squares with even number of rows. The knights-tour is based on the chessboard with a unit of 64 places. The piece called Knight moves diagonally in an awkward manner unlike other pieces in the game of chess. The Knight takes a move 2x3 or 3x2 oblong. The tour starts at one corner of the board and covers all the places touching each place exactly once. Out of the many possible tours, one such tour is given below.
MAGIC SQUARE:

8 3 4
KNIGHT’S TOUR:

1 5 9

6 7 2

1 52 3 16 63 50 13 26

4 17 64 51 14 27 62 49

53 2 15 28 35 40 25 12

18 5 54 39 32 29 48 61

55 38 31 34 41 36 11 24

6 19 42 37 30 33 60 47

43 56 21 8 45 58 23 10

20 7 44 57 22 9 46 59

Dept of C S E, Narayana Engineering College , Nellore

11

Cryptology And Communication

The first letter of plain text is placed at the cell indicated by numeral one, second letter at 2, third at 3 and so on. Once the job of positioning is over, the cipher text is ready and can be written row-wise. Geometric transposition is also called unit transposition. An example of complete unit transposition is indicated below which corresponds to the message: Blow the Naval Airbase on Republic Day KKK (32 letters plus 3 nulls) is written in form of block with five letters per row. B H A B N B A Cryptograms: (a) By descending verticals: BHABN BABEL ARLYO NASEL… ,etc. (b) By alternating verticals from the top right: TVROU DKKCP EIAWK IESAN OYLRA… ., etc. (c ) By diagonals: BHNAE OBLNW NAAAT BRSIV ALEER …, etc. Both the writing in and taking off follow a rule, and hence the cipher is also called route transposition and some times rectangle transposition. Decryptment is absolutely based on trials on the known routes. Major problem that an analyst encounters is the dimensions. One of the simple method of transpositioning the letters is obtained by dividing the given plain text into two strings and forming cipher text by writing down alternate letters as Plain Text: BLOW THE NAVAL AIRBASE ON REPUBLIC DAY. L E L A R L Y O N A S E I K W A I E P C K T V R O U D K

Dept of C S E, Narayana Engineering College , Nellore

12

Cryptology And Communication

B L O W T H E NAVALA I R B AS E O N R E P U B L I C DAY Cipher text: BAL SOE WOT NHR EEN PAU VBA LLI ACI DRA BY

This looks like zigzag way of arrangement. This is of regular type. The irregular type of transposition is comparatively complex with higher degree of difficulty, the simplest being RAIL-FENCE Cipher. In this the arrangement of letters look like the fencing provided for guarding the rail track. For instance the above plain text may be represented as, B T A V L A A I R B E S A O E R N P B I L U D Y A C

L W H N O E

Cipher text: BTA AAN UCL WHN VLI BSO RPB IDY OEA REE LA. Rather than remembering the system, which changes from time to time, it will be better to use the same system, but is governed by the changeable numeric key or a code word. For example a numeric key 4731256 can be derived from the keyword NUMBERS by arranging letters in it alphabetically. Using this keyword the cipher text for the above plain text will be N 4 B N R T B U 7 L A B H L M 3 O V A E I B 1 W A S R C E 2 T L E E D R 5 H A O P A S 6 E I N U Y

Cipher text:
Dept of C S E, Narayana Engineering College , Nellore 13

Cryptology And Communication

WASRC TLEED OVAEI BNRTB HAOPA EINUY LABHL. In this cipher, seven letters or seven numbers implies seven columns and hence the key-length is seven. The decryptment is just opposite to encryptment, and is completely based on how it is written in and taken off. This cipher is called nihilist transposition. This cipher text may be again sent to cipherment applying the keyword column wise, thus making the task of decryptment highly difficult. There is another ciphering technique, which came into existence many years ago, developed by cryptologist E. Myszkowsky, and is supposed to be non-decryptable. The keyword is repeated throughout until the text is sufficient enough to provide one key letter for one plain text letter. The letters in the key are assigned numeric values. With all A’s receiving the first number, all B’s the next number and so on. The ciphertext is taken off according to the sequence. For the above plain text if keyword is ADVICE cipher text will be: Keyword A D V I C E A D V I C E A D V I C E A 1 8 17 14 5 11 2 9 18 15 6 12 3 10 19 16 7 13 4 Plain text: B L O W T H E N A V A L A I R B A S E Cipher text: BEAET AALNI HISWV BOAR. The AMSCO cipher follows all zeros of a columnar transposition cipher except that letters are taken as pairs at every alternate place. Following is a cipher called the UNITED STATES ARMY DOUBLE TRANSPOSITION in which the same rules applies as in single columnar transposition. Nihilist transposition cipher is employed twice; Nulls are added if required; and the key is also used. Plaintext: B L O W T H E N A V A L A I R B A S E

1ST Encipherment

Dept of C S E, Narayana Engineering College , Nellore

14

Cryptology And Communication

N 4 B N R

U 7 L A B

M 3 O V A

B 1 W A S TLE

E 2 T L E

R 5 H A X

S 6 E I X LAB.

Primary Cryptogram: WAS 2nd Encipherment N 4 W V X U 7 A A E M 3 S B I

OVA BNR HAX EIX

B 1 T N X

E 2 L R L

R 5 E H A

S 6 O A B

Final Cryptogram: TNXLR LSBIW VXEHA OABAA E. The columns of the upper block are always used directly as rows in the lower block and then columns of the lower block are taken off as cryptogram. This kind of ciphers take the decryptor to trace for the length of the keyword and hence time of several hours or several days. The double columnar transposition can be made much complex when the key length is made long and the columns short, and can be made further more complicated by carrying out cipheremnet a third time; a different key with each new block can perhaps be used

3. SUBSTITUTION CIPHER: As the name indicates, a substitution cipher makes use of a set of symbols or letters to replace the existing letter with a new letter or symbol at that place. This kind if ciphering is used in the daily life also: The Morse code which uses
Dept of C S E, Narayana Engineering College , Nellore 15

Cryptology And Communication

dots and dashes, the Braille which is used for blind, the drum language of the African jungles, and so on. A cipher text as such is a difficult task to crack for a decryptor. The decryptor has to deal with a cryptogram, which consists of arbitrary science, and he begins the decryption by making a substitution of his own, by replacing each unfamiliar symbol with a letter or number. The substitution cipher is classified into four major groups as given below: Simple Substitution makes use of only one cipher alphabet; also called as mono-alphabetic substitution. Multiple-alphabet substitution makes use of several cipher alphabets according to an agreed plan to construct the cryptogram. It is also called as Double-key substitution, poly - alphabetic Substitution, etc. Sometimes the term multi-Substitutional cipher is also used to indicate the multiple-alphabetic substitution ciphering. Polygram – Substitution is a method in which groups of letters replaced with other groups consisting of different letters or numbers. Fractional Substitution is another method in which first ordinary substitution is performed on single letters and then these fractions are subjected to further encryption. The result is a combination cipher rather than a purely substitutional one. One of the oldest ciphering techniques of this type was used by Julius Caesar. Another one of such kind was in use by Octavius. Caesar formed the cryptogram be merely producing a shift on the normal alphabet. For instance, D can be obtained by a “Shift” of 3 on A; hence this forms a Caesar cipher 3. The entire cipher text is written down with a shift of 3. This kind of ciphers is supposed to be weak ciphers. Following is an example for the shifted cipher or Caesar cipher with a shift of 5. Plain text: Blow The Naval Airbase On Republic Day.

Dept of C S E, Narayana Engineering College , Nellore

16

Cryptology And Communication

Alphabet: AB C DE FG H I JK L MN O P Q R S T UVWXYZ Substitute: FG H I J KL M NO P Q R S T U V W X Y Z ABCDE Cipher text: GQTB YMJ SFAFQ FNWGFXJ TS YMJ WJUZGQNH IFD. This can be rewritten into groups of three letters or five letters according to the choice of the user. The plain text can be again found out by producing a shift of five but in reverse side. Producing the inverse alphabet and substituting it does another method of producing a cipher text. The inverse alphabets are given below. Alphabet: A B C D E F G H I J K L MN O P QR S TU V WX Y Z Substitute: Z Y X W VU T S RQ P O NM L K J I H GF E D C B A The same plain text would look as the following cryptogram once enciphered using the inverse cipher. Cipher text: YOLD GSV MZEZO ZRIYZHV LM GSV IVKFYORX WZB. Whenever a plain text alphabet is merely reversed and used as cipher alphabet, the encipherment is called Reciprocal alphabet cipher. The inverse alphabet cipher is one such example; the formation of other reciprocal alphabet is as follows: α a) A B C D E F G H I J K L M NOPQRSTUVWXYZ b)A B C D E F G H I J K L M SRQPONZYXWVUT c)E X A C T L Y B D F G H I ZWVUSRQ PONMKJ
Dept of C S E, Narayana Engineering College , Nellore 17

Cryptology And Communication

d)E X A C T L Y B D F G H I J K M NO P Q R S U V W Z In the example c) and d) given above the keyword EXACTLY is used. In case any letter in the key repeated, it is just omitted. The key must consist of well-mixed alphabets such as UNCOPYRIGHTABLE. The complex the cipher or substitute is, the stronger is the cipher text. For instance, the decryptment is very difficult if the substitute is like the following: Alphabet: Substitute: ABCDEFGH I J KLMNOP QRST UVWXYZ UBJ S ZLDKTPFMVEGNWRHOXCA I QY

Such kind of ciphers can be obtained by forming a mixed alphabetical cipher. Some of the methods are as follows: Keyword: EXACTLY (a) E XAC T LY BDFG H I J KM N O P Q R SUVWZ (b) (c) E XA* * C T LY E XAC T LY BDFGH I J KM 3 6 1 2 54 7 NOPQR S UVW ------------------Z ABCDEF G H I J K LM N O PQRSTU V W XY Z L M NO PQRSTUV WXY Z V C GOWTHPZL I Q Y J R Q H RC I S TJULK V YMW B F MTE LSZBI P WGN U

Alphabet : ABCDEFGH I J K Cipher(a) : EBKSXDMUAFN Cipher(b) : EBNZXDOA FPG Ciphre(c) : C J Q X D K R YAH O

In the polyalphabetic substitution cipher, the encipher can use any of the 26 letters to substitute a particular letter. The earliest known cipher of this kind is the PORTA in 1563. In 1586 came the VIGNERE; both of them used tableau. The Vignere tableau uses a 26x26 grid of alphabets, which was
Dept of C S E, Narayana Engineering College , Nellore 18

Cryptology And Communication

successfully eliminated in this project; otherwise an extra module would have been needed to prepare the 26x26 grid. The vignere tableau is given below. ABC D E F G H I J K L MNO P Q R S T U V W X Y Z ABC D E F G H I J K L M NO P Q R S T U V WX Y Z BCD E F G H I J K LM N O P Q R S T UV W X Y Z A CDE F G H I J KL MN O P QR S T U VW X Y Z A B DEF G H I J K LMNO P Q RS T U V WX Y Z A B C EFG H I J K LMNO P Q R ST UV W X Y Z A B C D FGH I J K LM N O PQ R S T UVW X YZ A B C D E GH I J K L MN O P Q R S T U VWX Y ZAB C D E F H I J K L M N O PQ R S T U V WXY ZABC D E F G I J K L M N O P Q RS T U V W X YZ ABCDE F G H J K L M N O P Q R S T U V W X Y ZA B C DE F G H I K L M N O P Q R S T U V W X Y Z AB CDE FG H I J L M N O P Q R S T U V W X Y Z A BC DEF GH I J K M N O P Q R S T U V W X Y Z A B CDE FG HI J K L N O P Q R S T U V W X Y Z A B C DE F GH I J K LM O P Q R S T U V W X Y Z A B C DE F G H I J KL M N P Q R S T U V W X Y Z A B C D E F G H I J KL MNO Q R S T U V W X Y Z A B C D E F G H I J KLMN O P R S T U V W X Y Z A B C DE F G H I J K LMNOPQ S T U V W X Y Z A B C D E F G H I J K L MN OPQR T U V W X Y Z A B C D E F G H I J K L MNO PQ RS U V W X Y Z A B C D E F G H I J K L MNO PQ R ST V W X Y Z A B C DE F G H I J K L MN O P QR STU W X Y Z A B C DE F G H I J K L MNO PQ RS TUV X Y Z A B C D E F G H I J K L M N O P Q R S T U VW Y Z A B C D E F G H I J K L M N O P Q R S T U V WX Z A B C D E F G H I J K L M N O P Q R S T UV W XY Fig. Vignere Tableau This can be consolidated when working with numerals i.e., A=0,B=1,. .,.., Z=25 can be used to add or subtract to the ASCII code of the plaintext. The cryptogram is based on the period (i.e., the length of key). If the key is CAT, then the cryptogram will have a period of 3. Keyword:

A B C D E F G H I J K L M N O P Q R S T U V W X Y Z

ABCABCABCABCAB....

Plaintext: BLOWTHEAI RBASE.... Cryptogram: B M Q W U J E B K R C C S F . . . .
Dept of C S E, Narayana Engineering College , Nellore 19

Cryptology And Communication

This can be grouped into 3 or 5 letter words. The Gronsfeld cipher arrived in 1655 and is a tricky method purely based on the numeric key. The idea is based on producing shift from the plaintext letter. Following is an example for Gronsfeld encipherment. Key: Plaintext: Cryptogram: 2 3 1 0 4 B L O W T D O P W X 2 3 1 0 4 H E A I R J H B I V 2 3 1 0 . . . . B A S E. . . . D D T E. . . .

The Beaufort cipher has two types – true Beaufort and variant Beaufort. It uses a 27x27-alphabet square in which all four of the outside alphabets are alike. The tableau resembles that of Vignere tableau. Sir Francis Beaufort developed the Beaufort cipher in 1857. Following is an example, which has the keyword C. True Beaufort Key :CCCCCCCC ... Plaintext : A B C D E F G H . . . C’gram : C B A Z Y XWV. . . Variant Beaufort CCCCCCCC... ABCDEFGH... YZABCDE F...

The porta cipher and its tableau are due to Giovanni Battista della porta. The tableau consists of 13 cipher alphabets along with their inverses, are governed by two key-letters. The porta tableau and encipherment are given below. A B C D E F G H I J K L M AB CD EF GH IJ KL MN OP QR ST UV N O P Q R O P Q R S P Q R S T Q R S T U R S T U V S T U V W T U V W X U V W X Y V W X Y Z W X Y Z N X Y Z N O S T U V W X Y Z N O P T U V W X Y Z N O P Q U V W X Y Z N O P Q R V W W X X Y Y Z Z N N O O P P Q Q R R S S T X Y Z N O P Q R S T U Y Z N O P Q R S T U V Z N O P Q R S T U V W
20

Dept of C S E, Narayana Engineering College , Nellore

Cryptology And Communication

WX Y Z N O P YZ Z N O P Q

Q R S T U R S T U V Fig. Porta Tableau.

V W X W X Y

Keyword: E A S T E A S T E A S T FAT S FAT S FAT S Plaintext : B L O W N A V A L A I R B L OW N A V A L A I R Cryptogram :Q Y F A L N MWN N R I Q Y F A L N M W N NR I The decipherment is many times easy as two or more keys can yield the plain text. The key-interruption method is simple to apply and easy to understand. A key word such as ORGANIZATIONAL is selected and applied on words along with word-spacing irregularly as ORGA OR ORGANIZA ORG ORGANI O ORGANIZATI ORG ---- The numeric ciphers implemented in the project are Tcipher and Nihilist numeric Substitution. Both use a grid of cipher alphabets called Checkerboard. Porta Table Giovanni Baptista della Porta developed the Porta Table cipher method in 1565. The table uses a keyword and the table below to encipher messages. Porta Table

AB CD EF GH IJ KL MN OP QR

a b c d e n o p q r a b c d e z n o p q a b c d e y z n o p a b c d e x y z n o a b c d e w x y z n a b c d e v w x y z a b c d e u v w x y a b c d e t u v w x a b c d e s t u v w

f g h i j k l m s t u v w x y z f g h i j k l m r s t u v w x y f g h i j k l m q r s t u v w x f g h i j k l m p q r s t u v w f g h i j k l m o p q r s t u v f g h i j k l m n o p q r s t u f g h i j k l m z n o p q r s t f g h i j k l m y z n o p q r s f g h i j k l m x y z n o p q r
21

Dept of C S E, Narayana Engineering College , Nellore

Cryptology And Communication

ST UV WX YZ

a r a q a p a o

b c d e f g h i s t u v w x y z b c d e f g h i r s t u v w x y b c d e f g h i q r s t u v w x b c d e f g h i p q r s t u v w

j k l m n o p q j k l m z n o p j k l m y z n o j k l m x y z n

To begin, write out your plain message and write out the keyword above it, as shown below: Keyword: Plain Message: JACKET LOOK UNDER THE COUCH.

The next step is to use the Porta table to create the enciphered message. Use the letters from the keyword (jacket in the example above) to locate the correct line to use in the Porta table. In the example above "J" is the first keyword letter. Thus, locate "J" on the left hand side of the Porta table - the letters in all uppercase. Once you locate the "J," the 5th set of uppercase letters in the Porta table, you use the letter from the plain message to find the enciphered letter above or below it. In this example the value for "L" in the "J" set is "U". See the example below: Notice how the letter "O" from the word "LOOK" has a different cipher value because of the different keyword letters. The first "O" is directly under the keyword character "A." Thus, the value of "O" in the "A" set is "B." The second "O" is in the "C" set with a value of "C" for letter "O." Once the cipher has been written you may want to add in extra characters, like the "z" at the end of my rewritten cipher, to confuse decipherers. Another good idea is to rewrite the cipher, as shown above, into blocks of letters. The example above blocks letters into groups of 3. To decipher a message encoded with the Porta table you'll need the keyword and the Pora table for reference. Simply write out the enciphered message and the keyword above it. Then, find the corresponding values for each letter, as you did
Dept of C S E, Narayana Engineering College , Nellore 22

Cryptology And Communication

during the enciphering process. When you are all done read the string of letters carefully to separate out the words and rewrite your message as a plain message with spaces and punctuation. Nihilist Numeric Substitution 1 A F L Q V 2 B G M R W 3 C H N S X 4 D IJ O T Y 5 E K P U Z

1 2 3 4 5

13 = C 34 = O 32 = M 15 = E 44 = T

Plain text : S E N D S U P P L I E S 43 15 33 14 43 45 35 35 31 24 15 43 Key : 13 34 32 15 44 13 34 32 15 44 13 34 C’gram : 56 49 65 29 87 58 69 67 46 68 28 77 Both the plain text and key are converted to codes and added to get the cryptogram, which is not grouped. In the T-cipher, no key is used but the plain text is enciphered according to specific pattern. The row and column positions are interchanged according to the even-odd position of the plain text. Plain text : M Y N A M E I S... Cryptogram : 62 84 63 40 62 44 53 37. . . This kind of codes are obtained in the T-cipher which uses a check board as follows: 4 5 6 7 8 9 0 A F K P U Z 1 B G L Q V 2 C H M R W 3 D I N S X 4 E J O T Y

The combinations 91,19,92,29,93,39,49 and 94 are not used for cipherment. This cipher gives a better output and tends to be a stronger type

Dept of C S E, Narayana Engineering College , Nellore

23

Cryptology And Communication

cipher. The cryptogram becomes totally unbreakable if the arrangement of alphabets is made at random. Delastelle as bifid and trifid had described one of the excellent examples for the fractional substitution. The bifid uses a two-unit alphabet and extended to keyword feature by M.E.Ohaver. The decryptment hence becomes highly difficult. An example has been given as follows: Preparation of alphabet DIA*MON BC E F G H K LPQRSTU VWX Y Z Checkerboard 1 2 3 4 5 1DB LV I 2 C PWAV 3QXF RY 4 MG S Z O 5HTNKU Substitutes S = 43 E = 25 N = 53 D = 11

First Substitution : SENDDIAMON DSTOD ELHINOW 42 5 1 112 4 4 5 1 454 1 21 515 4 2 35 3 1 154 1 5 3 1 325 1 53 153 5 3 Re- Substitution : 42 51 11 24 45 14 54 12 15 15 42 35 31 15 41 53 13 25 15 31 53 53 GH D A O V K B I I G Y Q I M N L E I Q N N Cryptogram : GHADO VKBIIG YQIMN LEIQN N . The bifid has two units of numbers; for a trifid there must be three units. Other simple ciphers are due to Vernam and Data Encryption Standard (DES). The Vernam cipher assumes a key and XORs every bit with the plain text letter, i.e., Plain text(P)  P XOR K  Cipher text  Plain text(P) (P XOR K) XOR K here XOR implies a modulo-2 adder. Another logic can be found as P-box, which can stand for both cipherment of letters or bits of each letter. If Pbox is applied for letters, then it will be transposition and for bits, it will be substitution type cipher. P-box logic stands as a foundation for the DES algorithm.

Dept of C S E, Narayana Engineering College , Nellore

24

Cryptology And Communication

0 1 2 3 4 5 6 7 Fig : Pbox 4. OTHER TECHNIQUES:

3 6 0 4 2 7 1 5

The conventional private key ciphers use the same key to decipher message as used to encipher it. All cryptograms, until Diffile and Hellman’s article in 1976,kept both the encryption and decryption keys secret. By application of key, abc becomes XYZ, and on the same key XYZ becomes abc; each can be derived from the other. Diffile and Hellman proposed to use an encryption algorithm, E, and a decryption algorithm, D. Both E and D are chosen so that deriving D would be impossible even if a complete description of E has been provided, i.e., 1. D (E (P)) = P. 2. It is impossible to derive D from E. 3.E cannot be broken by a chosen plaintext attack. The users A and B using this scheme of Public Key Cryptography use two different keys to pass secret messages. A computes his first message EB (p) and sends it to B. B decrypts it by applying his secret key DB, i.e., he computes

3.2

3.3 : Data Flow Diagrams

Dept of C S E, Narayana Engineering College , Nellore

25

Cryptology And Communication

With the computerization and the networking of computers the concept of secure communication again came to the fore. The general threats to the communication are 1.interception 2.modification 3.fabrication the problem of interception is other people might know what we are talking. there by they can our sectets i,e this is threat to confidentiality . by dencrypting the text of communication we can thwart those attempts. Here the communication between A and B is known to C.
A B

C

Modification, this deals with the problem of other people modifying the actual contents of the communication. The data transferred between A and B is being modified by C.
B A

C

LEVEL 1 DFD
Dept of C S E, Narayana Engineering College , Nellore 26

Cryptology And Communication

The communication between different users by using ciphering techniques can be shown as follows in the form of data flow diagram.The encryption and decryption can be shown as follows.

USER

Encrypt

Store/Se nd

Retrive

Decrypt

USER

Dept of C S E, Narayana Engineering College , Nellore

27

Cryptology And Communication

COMMUNICATION

4.1 Introduction : Due to the tremendous impact of computers and computer communications on society during the past decade, this period in history has come to be called the information age. The productivity and profitability of both organizations and individuals have been enhanced significantly by these revolutionary tools. Individuals use computer communications almost daily to conduct personal and professional business. This trend is accelerating as more people discover the power of computers and communications both for business and for homes. The day-to-day transactions at department stores, banks, reservation counters, and other business are all dependent on computer communication. The information age is equally dependent on the computer and the computer networks. Modern organizations today are widely dispersed, with offices located in diverse parts of a country and the world. Many of the computers and terminals at the sites need to exchange information and data often daily. The networking of computers permits the sharing of resources. The use of networking allows a very flexible working environment. Employees can work at home by using terminals tied through networks into the computer at the office. 4.3 Sockets : First and foremost in order to use the Winsock API you have to link to the libraries mpr.lib and wsock32.lib. To do this in Visual Studio create a new project then under the "Projects" menu choose "Settings...", or just hit Alt+F7. In the top left of the dialog box there is a drop down list box labeled "Settings For:" change it to read "All Configurations". In the tab control on the right of the dialog box select the "Link" tab. In the middle of the tab there is an edit box labeled "Object/Library Modules:" add the name of the libraries you want to link to, be

Dept of C S E, Narayana Engineering College , Nellore

28

Cryptology And Communication

sure all the labraries in the list are separated by spaces. That being done you can now begin to program. The first step in using the WinSock API is to initialize WSA. I'm not positive what WSA is, I'm assumng its short for WinSockApi, but I can't back that up. Whatever it is it has to be initilized. This is done by calling WSAStartup(). This function takes two parameters a version number in a WORD value and a WSADATA structure, it returns an integer the return will be 0 if initialization is successful. Here is an example of the initialization process: WSADATA WsaDat; if (WSAStartup(MAKEWORD(1, 1), &WsaDat) != 0) { printf("WSA Initialization failed."); } matter, For the version number I use the macro MAKEWORD(). It splits the version number up and its easy to see what you are requesting. When you send that version number you are requesting a specific version of WinSock, in the example I am requesting version 1.1. You can request version 1.0, 1.1, and 2.0, version 2.0 is not available in Win 95 without being specifically installed it does exist in all later versions of Windows. The exact benifits of each version I'll leave to you to research, from what I have read version 1.1 has all the important features and since its available in all version of Windows without a patch it is acceptable for most applications. After you have initialized WinSock the next step is to create a socket. Sockets are of two types stream sockets and datagram sockets. Stream sockets are easier to use so I'll demonstrate them. All sockets are of type SOCKET, and you create them with the socket() function. The socket() function takes three parameters. The first is the type of connection you would like to use, for this use AF_INET this designates you want to use an Internet style connection (or in other words use TCP/IP) as far as I know this is the only connection permitted through WinSock.
Dept of C S E, Narayana Engineering College , Nellore 29

Cryptology And Communication

The second parameter is the type of socket to use, for stream sockets use SOCK_STREAM, or for datagram sockets use SOCK_DGRAM. The thrid parameter is some value for the protocol from what I have read this value has very little meaning and is usually ignored so I always pass zero here. The socket() function will return the socket or INVALID_SOCKET if it can't create the socket. Here is an example of that: SOCKET Socket; Socket = socket(AF_INET, SOCK_STREAM, 0); if (Socket == INVALID_SOCKET) { printf("Socket creation failed."); } Now we have a usable socket, what we need to do is make use of it. As with any network connections you have to have a server and a client. For clarity I'm going to call the server the computer that is listening for and incoming connection and the client the computer that requests a connection with a server. Since the server has to be listening before a client can connect I'll show how to setup the server first. First we bind the socket to a TCP/IP port. This is done with the bind() function. The bind() function takes three parameters, a socket to bind to, a pointer to a data structure that has the port information (structure type STRUCTADDR), and the size of the structure with the port information. There are a few points of interest in this process so i'll just explain inside an example. //The prepared need to variables we will need SOCKADDR_IN SockAddr;

//We need a socket variable but for now // lets assume its the variable Socket we before. create one. //bind() does require one of those prepa // red sockets, so at one point you will /* For those who are paying attention you may have noticed that I said before that we need a struct SOCKADDR variable. Except I didn't declare one here. The reason is that struct SOCKADD_IN holds the same information in the same way
Dept of C S E, Narayana Engineering College , Nellore 30

Cryptology And Communication

as struct SOCKADDR does, the difference is that struct SOCKADDR_IN is easier to work with. */ //We want to use port 50 SockAddr.sin_port = 50; //We want an internet type connection (TCP/IP) SockAddr.sin_family = AF_INET; //We want to listen on IP address 127.0.0.1 //I'll give a few better ways to set thi // s value later SockAddr.sin_addr.S_un.S_un_b.s_b1 = 127; SockAddr.sin_addr.S_un.S_un_b.s_b2 = 0; SockAddr.sin_addr.S_un.S_un_b.s_b3 = 0; SockAddr.sin_addr.S_un.S_un_b.s_b1 = 1; //Ok all the information is set, lets bind() if (bind(Socket, (SOCKADDR *)(&SockAddr), sizeof(SockAddr)) == SOCKET_ERROR) { printf("Attempt to bind failed."); } That ought to be fairly straight forward to figure out. The connection type should always be AF_INET, the port is an unsigned integer between 0 and 65,565, and the address is four unsigned short values from 0 to 255 that is a valid IP address of the server. We can specify the IP address we want to listen to, what if we want to listen on multiple addresses? You could run throuh this process multiple times to bind a socket on each address, or you could set the SockAddr.sin_addr.S_un.S_addr to INADDR_ANY like this: SockAddr.sin_addr.S_un.S_addr = INADDR_ANY; Instead of setting the four octets of an IP address. The next issue that comes up would be how do I know my IP address? There is a way of finding the address,
Dept of C S E, Narayana Engineering College , Nellore 31

Cryptology And Communication

but its a little involved so I'm going to discuss that later. Now that we have a valid socket bound to a TCP/IP port we need to listen on that socket for incoming connections. We use the listen() function to accomplish that. The listen() function takes two parameters a bound socket and the number of connections to accept. Here is how that looks: //Once again we're carrying through the Socket variable from the previous example. //We're only going to accept 1 incoming // connection. listen(Socket, 1); Not much to listen(). Just to clarify the listen() function does not accept the incoming connections, it just sets your socket to listening on the specified port, no more no less. To accept the incoming connection you use accept(). The accept() function will will watch the port for a breif time then return an error. So unless you know exactly when the connection is coming and can start accept at just the right time you are going to miss the connection. One way around this is to place accept() in a while loop until a connection is received. There is a problem with this technique, in a DOS or console application its fine since nothing else can be happening it doesn't but in a windows program it will stop responding until it gets out of that loop. You may be able to set the accept() function to run on a short timer or in a loop that is called in a thread. At any rate here is how it would look if it were in a while loop until it received a connection: //We are still carrying through the Socket variable from before SOCKET TempSock = SOCKET_ERROR; while (TempSock == SOCKET_ERROR) { TempSock = accept(Socket, NULL, NULL); } Socket = TempSock;

Dept of C S E, Narayana Engineering College , Nellore

32

Cryptology And Communication

The reason for creating the TempSock variable is to preserve our real socket. I don't want to overwrite it with an error just because we missed a connection. I never looked into what is returned on a successful connection, I would assume it is the socket you started with, but from examples I looked at it doesn't appear to do that. All the documentation I read on accept() skipped over the return value, they just copied the results back into the original socket so I am doing the same. The second two parameters can be used to gain information on who connected by passing a pointer to a SOCKADDR structure and its size like this: SOCKADDR Addr; accept(Socket, &Addr, sizeof(Addr); I never tested sending a SOCKADDR_IN the same as in bind() but I haven't tested this so I won't guarantee the results of this. So now we are listening on a TCP/IP port and ready to accept a connection. So lets look into requesting a connection. To do this we use the connect() function. This function takes the same parameters as the bind() function except the port and address are the ones you want to connect to instead of listen on obviously. The connect() function will return a 0 if successful. Here is an example of that: //The variables we will need SOCKADDR_IN SockAddr; //We need a socket variable but for now lets assume its a variable Socket we prepared earlier. //We want to use port 50 SockAddr.sin_port = 50; //We want an internet type connection (TCP/IP) SockAddr.sin_family = AF_INET; //We want to connect to the IP address 1 // 27.0.0.1 //I'll give a few better ways to set thi // s value later SockAddr.sin_addr.S_un.S_un_b.s_b1 = 127; SockAddr.sin_addr.S_un.S_un_b.s_b2 = 0;
Dept of C S E, Narayana Engineering College , Nellore 33

Cryptology And Communication

SockAddr.sin_addr.S_un.S_un_b.s_b3 = 0; SockAddr.sin_addr.S_un.S_un_b.s_b1 = 1; if (connect(Socket, (SOCKADDR *)(&SockAddr), sizeof(SockAddr)) != 0) { printf("Failed to establish connection with server."); } Now that we have a server with a connected client they need to exchange information. This is done exactly the same for the client as it is for the server. The functions to use are send() and recv(). They both take four parameters the socket to send on, the data to send, and the number of bytes in the data. The way they expect the data is in a pointer to a char. You can bundle other values into this just typecast it into a char * and pass the correct number of bytes. The fourth parameter isn't used so give a zero there. These functions will return the number of bytes send or received if successful. They will return 0, WSAECONNRESET, or WSAECONNABORT if the connection was closed at the other end. These functions will also return SOCKET_ERROR if some error occurs during the transmission. They recv() function, like the accept() function, only watches for a brief period for the data to come through. Once again I place the function in a while loop until data is received. Here is how the recv() function looks in such a loop: int RetVal = SOCKET_ERROR; char String[50]; while (RetVal == SOCKET_ERROR) { RetVal = recv(Socket, String, 50, 0); if ((RetVal == 0)||(RetVal == WSAECONNRESET)||(RetVal == WSAECONNABORT)) { printf("Connection closed at other end.");
Dept of C S E, Narayana Engineering College , Nellore 34

Cryptology And Communication

break; } } Since errors are possible in sending the data I place it in a while loop as well. Here is how that looks: int RetVal = SOCKET_ERROR; char String[] = "Hello"; while (RetVal == SOCKET_ERROR) { RetVal = recv(Socket, String, strlen(String) + 1, 0); if ((RetVal == 0)||(RetVal == WSAECONNRESET)||(RetVal == WSAECONNABORT)) { printf("Connection closed at other end."); break; } } In these examples the data to send, or the received data is in the character array String. When the data is received there is a fixed amount of data that can be received so it is possible to overrun the buffer. That is a quick run through of how to use WinSock for network communications. Now as I said before there are ways of determining your own network address. This is by calling gethostname(). This will not return your IP address, only the text computer name. This function takes two parameters a character array to place the computer name in and the number of characters you have allocated in that array. Here is how it looks: char Name[255]; gethostname(Name, 255);

Dept of C S E, Narayana Engineering College , Nellore

35

Cryptology And Communication

If you look at the example above you'll note that it uses the IP address, not the computer name. What you can do is to call gethostbyname() which will give you information about a host based on its name. It takes only one parameter, the string that has the computer name, and it returns a pointer to a HOSTENT structure. Here is an example: HOSTENT *HostInfo; HostInfo = gethostbyname("computer"); if (HostInfo == NULL) { printf("Attempt to retreive computer information failed."); } The gethostbyname() function will search through DNS records in order to find the IP address. The careful readers will note that this HOSTENT structure is still worthless since it doesn't fit into the SOCKADDR_IN anywhere. The IP address is in the HOSTENT structure, its just buried. Here are the members of the HOSTENT structure that I found useful. The h_addrtype member holds the type of address this uses, as with the sockets the only type is AF_INET. The h_name is a character array that will contain the complete host and domain name for that computer, for instance host.domain.com. One catch to this, it will not do reverse name lookups, for example if you look up the computer name "MyComputer" h_name will hold "MyComputer.MyDomain.com" , however if you look up the computer named "10.10.10.1" (which is really its IP) it will not translate that into a computer name gethostbyname() will just put the text "10.10.10.1" in h_name. The last member I want to discuss is h_addr_list, this one is somewhat confusing so of course it has the information we are really after. The member h_addr_list if a variable of type char**, but every time I have used it only one dimension of the array is used. In the data that is filled the first four bytes hold the four octets of the IP address. The rest of the array holds the same information as h_name. The octets are written as unsigned char values so you would have to place them into the SOCKADDR_IN structure like this:
Dept of C S E, Narayana Engineering College , Nellore 36

Cryptology And Communication

SOCKADDR_IN SockAddr; HOSTENT *HostInfo; SockAddr.sin_addr.S_un.S_un_b.s_b1 = (unsigned char)HostInfo>h_addr_list[0][0]; SockAddr.sin_addr.S_un.S_un_b.s_b2 = (unsigned char)HostInfo>h_addr_list[0][1]; SockAddr.sin_addr.S_un.S_un_b.s_b3 = (unsigned char)HostInfo>h_addr_list[0][2]; SockAddr.sin_addr.S_un.S_un_b.s_b4 = (unsigned char)HostInfo>h_addr_list[0][3]; In that way you can use the computer's name to find its IP so you can connect to any server you have the name of. Using this same technique you can also find your own computers IP address. Most optional features can enhance the performance and capabilities of your application. However, your application should not fail if and when the optional features aren't available. For example, generally you can get better bulk data throughput if you increase your input and output buffer sizes with SO_RCVBUF and SO_SNDBUF. However, your application should still be able to function with the default buffer sizes if your attempts to change the buffer sizes fail (with the WSAENOPROTOOPT or WSAEINVAL error). You can (and should) avoid dependence on some optional features by redesigning your application. For example, you shouldn't require a specific amount of receive buffer space for your application to function. The doesn't require WinSocks to support the SO_RCVBUF socket option, so you may not be able to specify the system buffer space you get. For datastream sockets, you can (and should) always allocate this buffer space in your application instead of relying on system buffers. For datagram sockets, you'd have to redesign your application protocol to use smaller datagrams. Of course, there are some applications that cannot possibly function when a Windows Sockets implementation doesn't support a particular optional feature.
Dept of C S E, Narayana Engineering College , Nellore 37

Cryptology And Communication

For example, SOCK_RAW support is essential to many network monitoring type applications, that use ICMP pings. You should avoid using options that don't have standard API and behavior definitions. For example, sharing sockets. The Windows Sockets specification doesn't mention the possibility of sharing sockets, so socket sharing is an optional feature by implication. The problem is that each WinSock implementation that allows sharing may have different requirements. The SO_DEBUG socket option is another optional feature without a description. The WinSock specification doesn't describe SOCK_RAW or multicast support either, but fortunately we can refer to the de facto standard defined by Berkeley Sockets. Using a proprietary API extension like socket sharing is a step backward. You limit your application, and you complicate it also. The v1.1 WinSock does not define a standard way to identify individual WinSock implementations. There's no standards committee to assign specific manufacturer identifiers like the IEEE does for Ethernet and Token Ring network interface manufacturers. The WSAData structure returned by WSAStartup() provides a location for vendor specific information, but does not prescribe the format. In any case, the programming convenience of application reliance on optional features does not justify the incompatibility your application will suffer on different WinSock implementations. For instance, an application that uses socket sharing won't function on WinSocks that don't allow socket sharing, and may not function on different WinSocks that do allow it. Since it is possible to write any type of application without relying on proprietary features, we recommend that you avoid proprietary features altogether for the benefit of portability. After all, the main reason to use WinSock is to avoid proprietary APIs and take advantage of the standard. SOCK_RAW is a type of socket that denotes a "raw socket" in the same way that SOCK_STREAM denotes a datastream socket and SOCK_DGRAM denotes a datagram socket. It's a macro (defined in WINSOCK.H) that you use as the value for the type parameter in socket() function. As section 2.6.10 of the v1.1 Windows Socket specification states, the
Dept of C S E, Narayana Engineering College , Nellore 38

Cryptology And Communication

support of SOCK_RAW is not mandated. However, it is encouraged, so many WinSock implementations do provide support (one notable exception are TCP/IP stacks from Microsoft). Unfortunately, the WinSock specification doesn't describe the acceptable syntax. There are many variations of raw sockets, that correspond to different levels of support. True raw sockets allow free reign of the network and transport protocol headers. Fortunately, few applications need low-level raw sockets support. Most applications require the common variation that allows access to the ICMP protocol to provide the ping facility, and this is what most WinSock implementations provide. The Berkeley sockets API model for this "raw ICMP" API is well-defined. 5. Coding And Screen Layouts : /* CRYPTOGRAPHY Program for enciphering and deciphering various messages given by users or those which are stored in text files. */

#include <stdio.h> #include <conio.h> #include <ctype.h> #include <string.h> #include <graphics.h> #define ENCRYPT 1 char org[200],cp[200],temp[20][10],acp[6],dup[200],tp[200]; FILE *fp,*fp1; int stlen; /*length of string to be operated upon*/ int ed; /*determine whether to encode or decode*/ int dp[200]; /*states numeric cipher text codes*/ help() { char c,acp[6]; setbkcolor(1); page1: cleardevice();
Dept of C S E, Narayana Engineering College , Nellore 39

Cryptology And Communication

settextstyle(SMALL_FONT,HORIZ_DIR,5); setcolor(10); outtextxy(19,100,"AS CC CL CO"); outtextxy(19,200,"DC DV FA GR"); outtextxy(19,300,"HE IC IN KI"); outtextxy(19,400,"KT LD MI MY"); setcolor(7); outtextxy(19,100," :I/P STRING :CEASAR CIPHER :CLEAR :COMPLEMENT " ); outtextxy(19,200," :DIGRAM COUNT :DESEND_VERT :5_ALPHABET :GRONSFELD " ); outtextxy(19,300," :HELP :INTERCHANGE :INVERSE :KEY_INTER. " ); outtextxy(19,400," :KNIGHTS TOUR :LOAD FILE :NIHILST SUBS :MYSKOWSKY " ); goto bot; page2: cleardevice(); setcolor(10); settextstyle(SMALL_FONT,HORIZ_DIR,5); outtextxy(19,100,"NC NK NS PG"); outtextxy(19,200,"PO QU RE RF"); outtextxy(19,300,"SA TB UC UT"); outtextxy(19,400,"VB VE VI ZZ"); setcolor(7); outtextxy(19,100," :NIHILIST CHAR :NIHILIST NUM :NIHILIST_SUB :PROFILE GRAPH"); outtextxy(19,200," :PORTA :QUIT :REVERSE :RAILFENCE "); outtextxy(19,300," :SAVE DATA :TRUE_BEAUFORT :UPPER CASE :UNIT_TANSP "); outtextxy(19,400," :VER.BEAUFORT :VERNAM :VIGNERE :ZIG ZAG "); bot: setcolor(4); outtextxy(19,450,"press ESC to accept command,^a to page up,^d to page down"); settextstyle(TRIPLEX_FONT,HORIZ_DIR,5); outtextxy(180,30,"HELP MENU"); c= getch(); if (c==27) {cleardevice(); strcpy(acp,"ac");} if (c==4) { goto page2;}
Dept of C S E, Narayana Engineering College , Nellore 40

Cryptology And Communication

if (c==1) { goto page1;} } /* FUNCTIONS TO PREPARE STRING OR CHARACTER,ACCEPT I/P AND COMMANDS*/ accept_command(char tp[]) { register int i,j; puts("\nENTER THE COMMAND(... AT ANY TIME PRESS 'HE' FOR HELP...)"); for(i=0;;i++) { tp[i]=getchar(); if (tp[i]=='\n') break; } while(isspace(tp[0]) && ispunct(tp[0])) { for (j=0;j<i;j++) tp[j]=tp[j+1]; i--; } return i; } encrypt_decrypt() { int ab; printf("ENCRYPT(1)/DECRYPT(2): "); scanf("%d",&ab); return ab; } /* FUNCTIONS FOR IMPLEMENTING VARIOUS CIPHERS */ void arrange_matrix(int len) { register int l=0,z,i,j; z=stlen/len; if(stlen%len!=0) z++; for(i=0;i<len;i++) for(j=0;j<z;j++) { temp[i][j]=org[l]; l++; } }
Dept of C S E, Narayana Engineering College , Nellore 41

Cryptology And Communication

void char_key() { register i,k,l=0,len; register char key[10],t; stlen=strlen(org); printf("enter the key(less than 10 alphabets):"); gets(key); len=strlen(key)-1; arrange_matrix(len); for(l=0;l<len-1;l++) for(i=l+1;i<len;i++) { if(key[i]>=key[i+1]) { t=key[i+1]; key[i+1]=key[i]; key[i]=t; for(k=1;k<=len;k++) { t=temp[k][i+1]; temp[k][i+1]=temp[k][i]; temp[k][i]=t; } } } } convert(int x) { register int y,x1,y1,xx,t; if(x>73) t=x-1; /* if x>'l'decrease x */ else t=x; y=t-65; x1=y%5; /*find row and column numbers*/ y1=y/5; x1++; /*increment x,y by 1 to get exact number*/ y1++; xx=y1*10+x1; /* formula to compute encoded number*/ return xx; } void descend_vert(int num) { register i,m,len,t=0,l=0; len=stlen/5; if(num==ENCRYPT && stlen % 5 !=0)
Dept of C S E, Narayana Engineering College , Nellore 42

Cryptology And Communication

for(i=stlen;i<(len+1)*5;i++) org[i]='Q'; stlen=strlen(org); len=stlen/5; for(i=0;i<5;i++) { t=i; for(m=0;m<len;m++) { if(num==ENCRYPT) dup[l]=org[t]; else dup[t]=org[l]; t=t+5; l++; } } } void digram_count() { register int di[26][26],i,r,c; for(r=0;r<26;r++) for(c=0;c<26;c++) di[r][c]=0; for(i=0;i<stlen-1;i++) { r=org[i]-65; c=org[i+1]-65; di[r][c]++; } for(r=0;r<26;r++) { for(c=0;c<26;c++) { i=di[r][c]; if(i!=0) printf("%3c%c-%2d",r+65,c+65,i); if(wherex()>75) printf("\n "); } } printf("\n"); } else dup[i]=org[i]; }
Dept of C S E, Narayana Engineering College , Nellore 43

Cryptology And Communication

} void gronsfeld(int num) { register int i,k=0,len; register char key[10]; stlen=strlen(org); printf("Enter a numeric key (less than 10 digits):"); fflush(stdin); gets(key); len=strlen(key)-1; for(i=0;i<stlen;i++) { if (num==ENCRYPT) dup[i]=prepare_char(org[i]+key[k]-48); else dup[i]=prepare_char(org[i]-(key[k]-48)); k++; if(k>len) k=0; /* 26x26 grid eliminated succesfully*/ } } void key_interruption(int num) { register int i,j,k=0,len; register char key[10],ch; printf("enter a key(less than 10 alphabets):"); fflush(stdin); gets(key); len=strlen(key)-1; for(i=0;i<stlen;i++) { ch=org[i]; if(isspace(ch)) k=0; else if(isalpha(ch)) { if(num==ENCRYPT) ch=prepare_char(ch+key[k]-64); else ch=prepare_char(ch-key[k]+64); k++; if(k>=len) k=0; } dup[i]=ch; } } void knights_tour(int num)
Dept of C S E, Narayana Engineering College , Nellore 44

Cryptology And Communication

{ register int i,k,l=0; int t[8][8]={ 1, 4,53,18,55, 6,43,20, 52,17, 2, 5,38,19,56, 7, 3,64,15,54,31,42,21,44, 16,51,28,39,34,37, 8,57, 63,14,35,32,41,30,45,22, 50,27,40,29,36,33,58, 9, 13,62,25,48,11,23,46,26, 49,12,61,24,47,10,59, 3 }; stlen=strlen(org); for(i=stlen;i<64;i++) org[i]='Q';/* where Q is the null character*/ org[64]='/0'; strcpy(dup,org); stlen=strlen(dup); for(i=0;i<8;i++) { for(k=0;k<8;k++) { if(num==ENCRYPT) dup[l]=org[t[i][k]-1]; else dup[t[i][k]-1]=org[l]; l++; } } } void mit_rsa(int num) { register int i,c,c3; stlen=strlen(org); for(i=0;i<stlen;i++) if(num==ENCRYPT) { c=org[i]-64; c3=(c*c*c)%33; dp[i]=c3; } else { c=dp[i]; c3=(c*c*c)%33; c3=(c3*c3*c)%33; dup[i]=c3+64; } for(i=0;i<stlen;i++)
Dept of C S E, Narayana Engineering College , Nellore 45

Cryptology And Communication

printf("%4d",dp[i]); printf("\n"); } void nihilist_subst(int num) { register int i,k=0,len,key1[10],x1,y1,p; register char key[10]; stlen=strlen(org); printf("enter a key(less tha 10 digits):"); fflush(stdin); gets(key); len=strlen(key)-1; for(i=0;i<stlen;i++) key1[i]=convert(key[i]); if(num==ENCRYPT) for(i=0;i<stlen;i++) { dp[i]=convert(org[i])+key1[k]; printf("%4d",dp[i]); k++; if(k>=len) k=0; } else for (i=0;i<stlen;i++) { p=dp[i]-key1[k]; x1=p/10; y1=p%10; x1--; y1--; x1=x1*5+y1; if(x1>10) x1++; dup[i]=x1+65; k++; if(k>=len) k=0; } printf("\n"); } void num_key() { register char key[10]; register int i=0,l=0,m,k,len; printf("enter the key (less than 10 digits):"); fflush(stdin);
Dept of C S E, Narayana Engineering College , Nellore 46

Cryptology And Communication

gets(key); len=strlen(key)-1; do { for(i=0;i<len;i++) { m=key[i]; for(k=0;k<11;k++) { if(m>=0) { temp[i][k]=m; m--; } else { temp[i][k]=org[l]; l++; } } } } while(l!=stlen); l=0; for(k=0;k<11;k++) { for(i=k+1;i<=len;i++) if(isalpha(temp[i][k])) { dup[l]=temp[i][k]; l++; } dup[l+1]= ' '; } } void porta() { register int t,i,n,j,k=0,len,po[13][13]; register char key[10]; stlen=strlen(org); printf("enter a key(less tha 10 alphabets):"); fflush(stdin); gets(key); len=strlen(key)-1; for(i=0;i<13;i++) /* prepare lower part of tableau*/ {
Dept of C S E, Narayana Engineering College , Nellore 47

Cryptology And Communication

t=78+i; /*upper part is unique hence eliminated*/ for(j=0;j<13;j++) { po[i][j]=t; t++; if(t>90) t=78; } } for(i=0;i<stlen;i++) { n=(key[k]-65)/2; t=org[i]; if(t<78) { t-=65; dup[i]=po[n][t]; } else { for(j=0;j<13;j++) if(po[n][j]==t) break; dup[i]=65+j; } k++; if(k<len) k=0; } } void profile_graph() { register int al[26],i,k=0,d; float ap[26]; for(i=0;i<26;i++) al[i]=0; printf("string lengths: %d\n",stlen); for(i=0;i<stlen;i++) { d=org[i]-65; al[d]++; } for(i=0;i<26;i++) ap[i]=100*al[i]/stlen; puts("FREQUENCY COUNT CHART"); puts("----------------------"); for(i=0;i<13;i++) { printf("%2c%3d%6.2f",k+65,al[k],ap[k]); for(d=0;d<ap[k];d++) printf("*"); k++;
Dept of C S E, Narayana Engineering College , Nellore 48

Cryptology And Communication

gotoxy(45,wherey()); printf("%2c%3d%6.2f",k+65,al[k],ap[k]); for(d=0;d<ap[k];d++) printf("*"); printf("\n"); k++; } } void true_beaufort() { register int i,k=0,len; register char key[10]; stlen=strlen(org); printf("enter a key(less tha 10 digits):"); fflush(stdin); gets(key); len=strlen(key)-1; for(i=0;i<stlen;i++) { dup[i]=prepare_char(key[k]-org[i]+65); k++; if(k<len) k=0; /* 27x27 grid is eliminated */ } } void unit_transpose(int num) { register int i,j=0; stlen=strlen(org); for(j=0;j<stlen;j+=4) { if(num==ENCRYPT) { dup[j]=org[j]; dup[j+3]=org[j+1]; dup[j+1]=org[j+2]; dup[j+2]=org[j+3]; } else { dup[j]=org[j]; dup[j+1]=org[j+3]; dup[j+2]=org[j+1]; dup[j+3]=org[j+2]; } } for(i=j-4;i<stlen;i++) dup[i]=org[i];
Dept of C S E, Narayana Engineering College , Nellore 49

Cryptology And Communication

} void vernam_cipher() { register int i,k=0,len; register char key[10]; printf("enter the key(less than 10 digits):"); fflush(stdin); gets(key); len=strlen(key)-1; for(i=0;i<stlen;i++) { if(k>len) k=0; dup[i]=org[i]^key[k]; k++; } } /* SELECTION OF CIPHERING TECHNIQUES */ void command_processor() { register int i,quit=1; register char p,q; char a,b,fname[64]; int x,offs; while (quit!=0) { x=accept_command(acp); if (x>0) { p=toupper(acp[0]); q=toupper(acp[1]); } } } /* MAIN PROGRAM */ main() { int gmod=0,gdr; gdr=DETECT; initgraph(&gdr,&gmod,"e:\\tc\\bgi "); rectangle(10,0,600,460); outtextxy(30,430,"AUTHOR:BATCH-1V");
Dept of C S E, Narayana Engineering College , Nellore 50

Cryptology And Communication

settextstyle(TRIPLEX_FONT,HORIZ_DIR,5); outtextxy(130,200,"CRYPTOGRAPHY"); line(10,420,600,420); getch(); cleardevice(); command_processor(); getch(); }

/* IMPLEMENTING COMMUNICATION PROGRAMMING USING WINSOCK */ /* Server Programming */ /* Server.cpp This program implements a TCP Server */ #include <WinSock.h> #include <stdio.h> #define SERVER_PORT htons(4000) /* Function declarations */ void Initialize(); SOCKET Listen();
Dept of C S E, Narayana Engineering College , Nellore 51

Cryptology And Communication

void Close(SOCKET); void ReceiveData(SOCKET, char *); void Send(SOCKET, char *); void Receivech(SOCKET, char *); /* main() makes the appropriate funtion calls */ SOCKET sSock; void main() { FILE *fp2; SOCKET commSock; char receivedStr[1],sendstr[100],ch[1]; Initialize(); //initialize socekets commSock=Listen(); //starts listening blocking till client connect printf("Socket = %d\n", commSock); //int n=recv(commSock, receivedStr, 100, 0); fp2=fopen("a5.txt","w"); if(fp2==NULL) { printf("enter file not opened"); exit(1); } do { Receivech(commSock,ch); if(ch[0]=='y') { ReceiveData(commSock, receivedStr); fputc(receivedStr[0],fp2); } else break; }while(1); printf("Socket = %d\n", commSock); //receivedStr[0]='\0'; //n=recv(commSock, receivedStr, 100, 0); // ReceiveData(commSock, receivedStr); printf(" recevied completely:\n"); fclose(fp2);
Dept of C S E, Narayana Engineering College , Nellore 52

Cryptology And Communication

strcpy(sendstr,"hi we have sucess"); Send(commSock, sendstr); Close(commSock); } /* Initialize() is used to initialize the windows sockets API */ void Initialize() { WORD wVersionRequested; WSADATA wsaData; int err; wVersionRequested = MAKEWORD( 1, 1 ); err = WSAStartup( wVersionRequested, &wsaData ); if ( err != 0 ) { /* Tell the user that we couldn't find a useable */ /* winsock.dll. */ printf("\n couldn't find a useable winsock.dll"); exit(1); } /* Confirm that the Windows Sockets DLL supports 1.1.*/ /* Note that if the DLL supports versions greater */ /* than 1.1 in addition to 1.1, it will still return */ /* 1.1 in wVersion since that is the version we */ /* requested. */ if ( LOBYTE( wsaData.wVersion ) != 1 || HIBYTE( wsaData.wVersion ) != 1 ) { /* Tell the user that we couldn't find a useable */ /* winsock.dll. */ WSACleanup( ); printf("\n couldn't find a useable winsock.dll"); exit(1); } } /* Listen() binds and listens as the server and accepts any incoming connection request */ SOCKET Listen() { SOCKADDR_IN serverAddr; SOCKET serverSock=socket(AF_INET, SOCK_STREAM, 0); /* set server address */
Dept of C S E, Narayana Engineering College , Nellore 53

Cryptology And Communication

serverAddr.sin_family = AF_INET; serverAddr.sin_port = SERVER_PORT; serverAddr.sin_addr.s_addr = INADDR_ANY; memset(&(serverAddr.sin_zero), 0, 8); /* bind server to its port */ if (bind(serverSock, (LPSOCKADDR)&serverAddr, sizeof(struct sockaddr)) == 0) { printf("\n\t Socket bound to its port....."); } else { printf("\n\t Socket Bind operation failed (Error #%d) exiting....", GetLastError()); exit(1); } /* start listening for incoming connection requests */ if (listen(serverSock,4)==0) { printf("\n\t Listening for connection request....."); } else { printf("\n\t listen() operation failed (Error #%d) exiting....", GetLastError()); exit(1); } SOCKADDR_IN clientAddr; SOCKET clientSock; int sin_size=sizeof(struct sockaddr_in); /* accept a connection request from the client */ clientSock=accept(serverSock, (LPSOCKADDR)&clientAddr, &(sin_size)); printf("\n\t Connection request received and accepted."); sSock = serverSock; return(clientSock); } void ReceiveData(SOCKET sock, char * receivedStr) { int n=recv(sock, receivedStr, 1, 0); //receivedStr[n]='\0'; // printf("\n\n received string = %s\n" // " # of bytes received = %d\n", receivedStr, n);
54

Dept of C S E, Narayana Engineering College , Nellore

Cryptology And Communication

} void Receivech(SOCKET sock, char * ch) { int n=recv(sock, ch, 1, 0); //receivedStr[n-1]='\0'; printf("\n\n received string = %c\n" " # of bytes received = %d\n", ch[0], n); } void Send(SOCKET sock, char * strToSend) { int n=send(sock, strToSend, 100, 0); if (n<0) { printf("\n send() failed Error # = %d",WSAGetLastError()); exit(1); } else { printf( "\n\n Send() successful \n" " # of bytes sent = %d\n", n); } } void Close(SOCKET sock) { closesocket(sock); WSACleanup(); }

/* /* #include <winsock.h> #include <stdio.h>

Client programming */ Client.cpp This program implements a TCP Client */

#define SERVER_PORT htons(4000) /* Function declarations */ void Initialize();
Dept of C S E, Narayana Engineering College , Nellore 55

Cryptology And Communication

SOCKET Connect(char *); void Receive(SOCKET, char *); void Send(SOCKET, char *); void Close(SOCKET); void Sendch(SOCKET,char *); /* main() makes the appropriate funtion calls */ void main() { FILE *fp; char receivedStr[100],sendStr[1],ch[1]; Initialize(); // strcpy(sendStr,"Hello TCP sockets"); SOCKET clientSock=Connect("127.0.0.1"); ch[0]='y'; fp=fopen("d:\\input.txt","r"); if(fp==NULL) { printf("file not opened"); exit(1); } while((sendStr[0]=fgetc(fp))!=EOF) { Sendch(clientSock,ch); Send(clientSock,sendStr); //Send(clientSock,sendStr); } if(sendStr[0]==EOF) { ch[0]='n'; Sendch(clientSock,ch); } Receive(clientSock,receivedStr); fclose(fp); Close(clientSock); } /* Initialize() is used to initialize the windows sockets API */ void Initialize() {
Dept of C S E, Narayana Engineering College , Nellore 56

Cryptology And Communication

WORD wVersionRequested; WSADATA wsaData; int err; wVersionRequested = MAKEWORD( 1, 1 ); err = WSAStartup( wVersionRequested, &wsaData ); if ( err != 0 ) { /* Tell the user that we couldn't find a useable */ /* winsock.dll. */ printf("\n couldn't find a useable winsock.dll"); exit(1); } /* Confirm that the Windows Sockets DLL supports 1.1.*/ /* Note that if the DLL supports versions greater */ /* than 1.1 in addition to 1.1, it will still return */ /* 1.1 in wVersion since that is the version we */ /* requested. */ if ( LOBYTE( wsaData.wVersion ) != 1 || HIBYTE( wsaData.wVersion ) != 1 ) { /* Tell the user that we couldn't find a useable */ /* winsock.dll. */ WSACleanup( ); printf("\n couldn't find a useable winsock.dll"); exit(1); } } /* Connect() makes a connection request to the server */ SOCKET Connect(char *IpNumber) { SOCKET clientSock=socket(AF_INET,SOCK_STREAM, 0); if(GetLastError()!=0) { printf("\n Error # %d exit(1); } /* specify server's address */ SOCKET serverSock=socket(AF_INET, SOCK_STREAM, 0); SOCKADDR_IN serverAddress; serverAddress.sin_family=AF_INET; serverAddress.sin_port=SERVER_PORT; serverAddress.sin_addr.s_addr=inet_addr(IpNumber);
Dept of C S E, Narayana Engineering College , Nellore 57

exiting....",GetLastError());

Cryptology And Communication

memset(&(serverAddress.sin_zero), 0, 8); if (connect(clientSock, (LPSOCKADDR)&serverAddress, sizeof(struct sockaddr))==0) { ///printf("\n\t Connection with server established....."); } else { printf("\n\t connect() operation failed (Error #%d) exiting....", GetLastError()); exit(1); } return(clientSock); } void Receive(SOCKET sock, char * receivedStr) { int n=recv(sock, receivedStr, 100, 0); receivedStr[n-1]='\0'; printf("\n\n received string = %s\n" " # of bytes received = %d\n", receivedStr, n); } void Send(SOCKET sock, char * strToSend) { int n=send(sock, strToSend, 1, 0); if (n<0) { printf("\n send() failed Error # = %d",WSAGetLastError()); exit(1); } else { printf( "\n\n Send() successful \n" " # of bytes sent = %d\n", n); } } void Sendch(SOCKET sock, char * ch) { int n=send(sock, ch, 1, 0); if (n<0) { printf("\n send() failed Error # = %d",WSAGetLastError()); exit(1); } else { printf( "\n\n Send() successful \n" " # of bytes sent = %d\n", n); } } void Close(SOCKET sock) { closesocket(sock); WSACleanup(); }

Dept of C S E, Narayana Engineering College , Nellore

58

Cryptology And Communication

Screen Layouts :

Dept of C S E, Narayana Engineering College , Nellore

59

Cryptology And Communication

Help Menu  1

Help Menu  2
Dept of C S E, Narayana Engineering College , Nellore 60

Cryptology And Communication

Implementation Of Different Ciphering Techniques :

Dept of C S E, Narayana Engineering College , Nellore

61

Cryptology And Communication

Dept of C S E, Narayana Engineering College , Nellore

62

Cryptology And Communication

IMPLEMENTATION
Dept of C S E, Narayana Engineering College , Nellore 63

Cryptology And Communication

7.1 Applications & Discussion : Modern encryption and decryption techniques make practically impossible for an intruder to read messages over communication channels.This chapter deals with various applications and discussion on the result of Cryptology Applications:  Secure communication channels  Authentication  Digital signatures  Computer user identification Cryptology used for secure communications can be split into two categories, secret_key and public_key. SECRET_ KEY: Only one key is used for both enciphering and deciphering the message PUBLIC_KEY: Different keys are used for enciphering and deciphering the message. This means that who ever enciphers the message is unable to decipher. AUTHENTICATION: Any intruder may inject messages of his own into a communication channel. Authentication is the detection of such forged encrypted messages.

DIGITAL SIGNATURES:

Authentication allows a receiver to be confident that the message has been sent by the source, it does not enable him to convince others that the

Dept of C S E, Narayana Engineering College , Nellore

64

Cryptology And Communication

message originated from the particular source. It is in such disputable cases that digital signatures are of great help. COMPUTER USER IDENTIFICATION: These are the techniques used for enhancing the secrecy of computer passwords. Whenever user seeks the service of a computer, how can the computer make sure that the user is not forgetting a faults identity. The computer does not need to know the actual passwords, it merely needs to be capable of validating the given passwords.
COMPARATIVE STUDY OF VARIOUS CIPHERS:

Here the table below shows comparision of various ciphering techniques. Cipher Name Inter Change Complem ent Inverse Ab ic Ty S Memory need ---------Time Need O(n) Weak/ strong Moderate Skill to decrypt less Advantages demerit

co in

S S

---------26 places to store the inverse alphabets ------------------A grid of 5*26 elements ---------------------------------------------

O(n) O(n)

Very weak Weak

Very less Moderate

Can be complex by few If no. of inter interchanges Changes are more plaintext can Be found Difficult to easily Understand on decryptable first look

Reciproc al Ceasar technique Gronsfel d Rail fence Myszkow sky Vernam Unit transposit ion

re Cc Gr rf my ve ut

T T S T T S T

O(n) O(n) O(n) O(n) O(n) O(n) O(n/k) k is length

Very weak Weak Strong Moderate Very strong Weak Weak

Very less less High Moderate analysis Very high moderate moderate Decryption diffi cult if 5*26 grid prepared random Key is used

Easily Decryptable Uses a offset

Trail and samples can

Dept of C S E, Narayana Engineering College , Nellore

65

Cryptology And Communication

of unit ihilist transposit ion Double transposit ion Knights tour applied Porta Cipher name Vignere nt dt kt T T T Grid of 8*8 elements Strong Strong Moderate high high high Very difficult To decrypt Difficult to under stand the random pattern of letters and can confuse an expert analyst advantages The grid can be in implementation key is used -do-do-

yield the plaintext

can be only if the plaintext length is a multiple of 64. demerits

po Ab vi

S Ty S

Memory need Grid of 26*26 elements 27*27 grid 27*27 grid -------

Time need O(n)

Weak / Strong Strong

Skill to decrypt high

Variant beaufort True beaufort Zig-Zag

vb tb zz

S S T

O(n) O(n) O(n)

Strong Strong Weak

high high less

A look at the alternative letters yields the text Key used Very difficult To decrypt difficult To decrypt Key used Key used . Very difficult To decrypt

Descend verticals T-cipher MIT algorith m Key interrupti on Nihilist number substituti on

dv tc

T S

----------------O(n) O(n) O(n) O(n)

Moderate Strong Strong Strong Strong

high high high Moderate high

Index

Ab-abbreviated form Ty-type S-substitution

T-transposition

Dept of C S E, Narayana Engineering College , Nellore

66

Cryptology And Communication

7.2 Limitations : Many of the famous ciphering techniques such as Ceaser cipher, Beaufort, Vignere, Nihilist, Porta, Gronsfeld, etc., had been discussed in this project. Because of many practical considerations, many more famous ciphering techniques are not included such as polyfair alphabetic, AMSCOciphering, DES algorithms, etc. These techniques needed greater amount of time, memory space and above all greater understanding of the methods. Algorithms such as Data Encryption Standard(DES)algorithms are needed highly complex, and also need operations at the bit level. There are .  The code that has been made more interactive and informative.This is done by allowing few status profiles With the inclusion of high performance  Data profiles and graphs. The cryptologists can arrive at conclusions at a quick rate. This is because, it is easier for humans to understand data that is represented graphically than that which is numerics, and on the other hand gives impressive look to the output.  A major part of cryptologists work will be simplified if the software is smart enough to understand text input and basing on the input it can suggest the cryptologists which algorithm will be the most suitable. A similar idea can also be implemented while deciphering the cipher text.

 One

of

most

challenging

work

will

be

autoencipherment

and

autodecipherment of given message. Many such algorithms available which need very less effort to understand and implement. With the help of this, the cryptologist’s job will be less mind-teasing. One very simple technique is to generate, for instance, 20cipher text messages corresponding to the 20 different ciphering algorithms available automatically for the given plaintext

Dept of C S E, Narayana Engineering College , Nellore

67

Cryptology And Communication

and selecting the one which is desirable. The same case also applies on decipherment of ciphertext.

8. CONCLUSIONS : This project helps effective communication between two parties without third party being involed.This project helps confidential exchange of information.Hackers cannot gain any knowledge about the text of users who use these components. This project has few limitations and it can be expanded in the future to a cosiderable extent. Some of the important arena where the scope of expansion is identified has been described in detail in this chapter. , many more famous ciphering techniques are not included such as polyfair alphabetic, AMSCOciphering, DES algorithms, etc. These techniques needed greater amount of time, memory space and above all greater understanding of the methods. Algorithms such as Data Encryption Standard(DES)algorithms are needed highly complex, and also need operations at the bit level. This chapter will be of great usage or those headers and enthusiasts who wish to Select cryptology as their topic of interest.  The complexity of ciphering a plaintext can be considerable raised complex algorithms take much time for processing but generate highly reliable ciphertext..These are the techniques used for enhancing the secrecy of computer passwords.  The source code of this project has been presented in C language; the executable coded thus produced occupies large space and take more time to execute when compared with assembly language.

Dept of C S E, Narayana Engineering College , Nellore

68

Cryptology And Communication

 The transmission of data in our project can be done by using sockets.where the communication is very fast.

9. FUTURE ENHANCEMENTS: The future enhancements in this project can be explained as follows.  Highly complex and reliable error checking and correcting methods can be applied. The result of such computations can be suffixed to the packet to be transmitted. A similar check can be made after the receipt of the packet to ensure the correctness.  The transfer of data done using this project is slow and needs improvement. The slowness is because of the protocol that every character must be acknowledged. This may be avoided by introduction of 1KB or 2KB packets without response after every character. But after every packet, the transfer will be much more feasible. Even though there is a risk of loss of information, it can be tackled easily by checking the checksum field and in case of corrupt packet, a request for retransmission can be made.  A file to be sent can be divided into number of packets with header, checksum, etc. This helps in increasing the communication speed along with greater reliability.  This project works on the basis of simplex protocol for noisy channel. This can be extended so as to implement much-sophisticated algorithms such as sliding window protocols.

Dept of C S E, Narayana Engineering College , Nellore

69

Cryptology And Communication

10. BIBLIOGRAPHY:

Name Of The Book 1. Network Security 2. Security For Computer 3. Complete Reference VC++
4. John Wayner

Authors William Stallings D.W.Davis and W. .L.Price Herbert Schildt
Disappearing Cryptography

WEBSITES: www.Laynetworks.com www.cryptography.com www.cryptography-tutorial.com www.winsock.com

Dept of C S E, Narayana Engineering College , Nellore

70

You're Reading a Free Preview

Download
scribd
/*********** DO NOT ALTER ANYTHING BELOW THIS LINE ! ************/ var s_code=s.t();if(s_code)document.write(s_code)//-->