Applying Message Authentication Code (MAC) in text chatting system

The use of Cryptograph y of text Authentication has become a standard approach in many applications, particularly in Internet Security Protocols. This research describes a new approach of authentication text and can be applied to text chatting system . This work present s simple and practical constructions Message Authentication Code (MAC) based on a cryptographic hash function. The proposed MAC Code provides security and authenticity for any length of messages, furthermore it is fast and easy to implement.


Introduction:
Message authentication is used when two parties sharing a key a wish to communicate and have some assurance that each received message comes from the purported sender and has not been altered along the way (Krovetz T., 2005).This is one of the most widely used cryptographic primitives and it may become even more so as security concerns grows.It is reasonable to anticipate that virtually every transmitted message (or packet) will use cryptographic means to ensure authenticity [Krovetz T., 2005][Bellare M., [10] 1995].Most commonly such a mechanism is based on a secret key a shared by the parties and takes the form of a message authentication code (MAC) [Bellare M., 1995].A message authentication code (MAC) provides a way to detect whether a message has been tampered with during transmission.The usual model for authentication includes three participants: A transmitter, a receiver and an opponent.The transmitter sends a message over an insecure channel, where the opponent can introduce new messages as well as alter existing ones.The goal of opponent is to deceive the receiver into a believe that the new message is authentic [Boesgaard M., 2005] .If the sender and receiver would use a MAC utilizing a (secret) key there would be no way for the opponent to intercept and send out a new message as he doesn't know the key [ Krovetz T., 2005][ Boesgaard M.,2005].There are two primary methods of constructing MACs: with block cipher or with hash functions [Bellare M., 1998] [Gouda M., 2003].The most prevalent MAC is the cipher block chaining message authentication code(CBC MAC) specified in the international standard ISO and the U.S. standard ANSI, which depends on DES block cipher [Bellare M., 1995][ Gouda M. , 2003].
Wegman -carter [Krovetz T. , 2005] message authentication paradigm is for the sender first to hash the message with a hash function known only to himself and the receiver.The sender then applies some cryptographic function (usually encryption) to the resulting hash value which produces a message tag that's sent along with the message to the receiver.The receiver can then repeat the process verifying that the received tag is valid for the received message in a correctly designed MAC only those knowing the secret hash function and cryptographic key have a reasonable chance of creating a valid tag for any new message.Gilbert, Mac Williams and Sloane [Edgar N., 1974] introduced the idea of provably secure authentication.This method is fast, but it requires keys longer than L bytes to handle L -bytes messages, and it requires a completely new key for each message, Wegman and Carter [Wegman M., 1979] pointed out that the key length could be merely 64 long L for the first message plus 16 bytes for each additional message .Karp and Rabin [Karp R., 1987] achieved a key length of 32 bytes for the first message.
This research presented a proposed MAC depending on calculating hash function and applying it in text chatting system.The proposed MAC used a secret key encryption and accepted any length of messages.The new MAC is to detect any opponent activities i.e. disclosure, insertion, deletion, and rearranging of message characters while sending through computer's network; so it provides both message authentication and security.

Hash Function:
Cryptographic hash functions play an important role in achieving authentication and data integrity.The basic idea of cryptographic hash functions is that a hash value serves as a compact representative image (sometimes called an imprint, digital fingerprint, or message digest) of an input string, and can be used as if it were uniquely identifiable with that string.Hash functions take a message m and produce a hash value.Messages can be of arbitrary length, while the hash value is a fixed length value.Following at the highest level, Cryptographic hash functions may be classified into two classes: hash functions, whose specification dictates a single input parameter -a message unkeyed hash functions; and keyed hash function, whose specification dictates two distinct inputs a message and a secret key [Stallings W., 1999] [ Audubon J. , 2003].
This paper concerned with keyed hash functions which are also called one -way hash functions (or Message Authentication Code (MAC)).Atypical usage of one-way hash functions for data integrity is as follows: The hash -value corresponding to a particular message M is computed at time t 1 .At a subsequent time t 2 , the following test is carried out to determine whether the message has been altered, i.e., whether a message M' is the same as the original message.The hash -value of M' is computed and compared to the protected hash -value; if they are identical, one accepts that the inputs are also equal, and thus that the message has not been altered [Stallings W., 1999] [Jan C., 1998].
A hash-value should be uniquely identifiable with a single input in practice, and collisions should be computationally infeasible to find (essentially never occurring in practice).In this paper, a novel and fast oneway hash function is proposed, The proposed one-way hash function (MAC) is based on calculating 5 bytes hash value to provide more security and authenticity to the hash value itself [Stallings W., 1999] [JiXian Y., 2005].

Message Authentication Code (MAC):
An alternative authentication technique involves the use of a secret key to generate a small fixed-size block of data known as a cryptographic checksum or MAC that is appended to the message.This technique assumes that two communicating parties, say A and B, share a common secret key K.When A has a message to send to B, it calculates the MAC as a function of the message and the key: MAC = C k (M).The message plus MAC are transmitted to the intended recipient.The recipient performs the same calculation on the received message using the same secret key, to generate a new MAC .The received MAC is compared to the calculated MAC.If we assume that only the receiver and the sender know the identity of the secret key, and if the received MAC matches the calculated MAC then the receiver is assured that the message has not been altered and the message is form the alleged sender.MAC mechanism can be illustrated in Figure 1

The Proposed MAC Description:
To provide message authentication and security in the proposed system, the following ideas has been depended : A. The MAC depended on secret encryption methods.The secret key shared between communication parties (i.e.sender and receiver) .[Schneier B.,1996] [Pfleeger C., 1989] B. To provide the security to the resulted cipher text; the idea of transposition methods was used depending on the secret key .D. To provide high level of message authentication and security in the proposed MAC.The MAC value not transmitted with the message separately but it embedded in the message and the all (message and MAC value) are encrypted according to the new proposed method .

. The proposed algorithm :
First : the sender do the following steps : 1. Input the message (plain text) and do message padding operation if message length MOD 5 not equal zero . .Make XOR operation between each 5 characters (block) of the characters sequence resulted from step 8 with 5 bytes key to produce the cipher text, which will be send to the receiver.the sender algorithm flowchart of the proposed system is clarified in figure 2 .
Second: The Receiver Do the Following Steps: 1. Input cipher text, and it's length MOD 5 must be zero .The message isn't authentic [18]

Conclusions:
In this paper, a novel message authentication code (MAC) is presented and applied in text chatting system.The proposed MAC system has many good features include: High speed of operation, Easy to implement and accepted any length of messages .
The proposed MAC system uses high complexity hash value (tag) which consists of 5 bytes and each byte results from different calculations.The hash function is used to present hash value (MAC) is collision free so it's computational infeasible to find two messages have same hash value.
To provide high level of security and authenticity in the proposed MAC system, the hash value (MAC, tag) not transmitted with the message separately but it embedded in the message and the all (message and MAC value) are encrypted using the idea of transposition methods .
Figure 1 MAC Mechanism [Schneier B. ,1996] [Pfleeger C. , 1989] C. The proposed MAC use hash function in different way.First the key inserted in the begin and end of the message, Second calculate 5 bytes hash values of the new message .

2 . 4 .
Figure 2 sender algorithm for the proposed system

2 .TheFigure 3
Figure 3 receiver algorithm for the proposed system