International Journal of Computer Applications (0975 – 8887) Volume 56– No.2, October 2012 18 ASCII KS Discrete Matcher: A Different and a New Approach to String Matching using Pattern in Discrete Manner Kuljinder Singh Bumrah Saurabh Rawat Anushree Sah Sumit Pundir Graphic Era Hill University, Bhimtal Graphic Era University, Dehradun The University of Greenwich, U.K The Graphic Era University, Dehradun ABSTRACT Many researchers have implemented string matching algorithms in various fields for instance finding the secret key RSA or other encryption methods as well as finding intruder’s pattern in Intrusion Detection System, DNA matching, Carbon Chain matching. This paper aims to analyze and obtain an algorithm for discrete pattern matching. It also works for any type of string whether it be characters, decimal values or special symbols. 1. INTRODUCTION The string matching problem, also called pattern matching [2], is defined as the operation of finding one or all of the occurrences of a pattern of characters P of length m in a larger text T of length n in discrete form. The problem has been extensively studied. String matching algorithms are mostly used in information retrieval, bibliographic search, molecular biology, cryptography and question answering applications. String matching is a very important issue in the domain of text processing [11]and its algorithms are considered as the basic components used in implementations of practical software under most operating systems. Moreover, they emphasize programming methods that serve as paradigms in other fields of computer science. 2. A New Concept – ASCII KS Discrete Matcher: All In this algorithm pattern matching is done in discrete manner [12]. Pattern is broken in a segment of two characters and ascii value is calculated of each character and hash value of each segment is calculated by multiplying the second character of the segment by 255 because the maximum ascii value can exceed to 255. The hash value of each segment is stored in an array. Then the ascii value of each character of the main text is calculated and hash value of pair of characters is calculated by shifting character –by-character and the hash value is stored in another array. The hash value of the two array is compared if all the value of the each segment of the pattern is matched with the each the main text, then the pattern is matched otherwise not. The algorithm has been designed (figure 1) below. ASCII KS Discrete Matcher nlength[T] mlength[P] j0 k0 for i1 to m do aASCII_VALUE(P[i]) hphp+a*pow(255,j) jj+1 if j=2 pt_hash[k]hp hp0 kk+1 j0 l0 for s1 to n do ht0 aASCII_VALUE(t[s]) bASCII_VALUE(t[s+1]) htht+a+b*255 txt_hash[l]ht ll+1 z0 for i1 to k