Upcoming SlideShare
×

38 116-1-pb

379 views
297 views

Published on

Published in: Technology, Education
0 Likes
Statistics
Notes
• Full Name
Comment goes here.

Are you sure you want to Yes No
• Be the first to comment

• Be the first to like this

Views
Total views
379
On SlideShare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
3
0
Likes
0
Embeds 0
No embeds

No notes for slide

38 116-1-pb

1. 1. ISSN: 2277 – 9043 International Journal of Advanced Research in Computer Science and Electronics Engineering Volume 1, Issue 2, April 2012 Tripartite Modular Multiplication using Toom-Cook Multiplication Amar Mandal, Rupali Syal compute modular multiplication these method also execution Abstract— Modular multiplication is the fundamental in parallel way.operation in most public-key cryptosystem. Therefore, theefficiency of modular multiplication directly affects the The proposed modular multiplication algorithm thatefficiency of whole crypto-system. This paper presents an efficiently integrates three existing algorithms, Barrettefficient modular multiplication algorithm for large integer. modular multiplication, Montgomery modular multiplicationThe proposed algorithm integrates with three existing and Toom-Cook multiplication, this proposed algorithmalgorithm, Barrett Algorithm and Montgomery algorithm for divide into two step multiplication and modularmodular multiplication, Toom-Cook algorithm for multiplication step. Multiplication step Toom-cook algorithmmultiplication. This algorithm execution done in parallel way sothat enhance the performance. These algorithms Analysis with is used. Modular multiplication step Barrett and Montgomeryrespect to their performance and compare to other modular algorithms are used in parallel way. The proposed algorithmmultiplication algorithms. minimizes the number of single-precision multiplication Index Terms— Barrett algorithm, Bipartite modular enable more than three way parallel computation.multiplication, Karatsuba multiplication algorithm, The remainder of this paper is structured as follows.Montgomery algorithm, Toom-Cook multiplication, Tripartite Section 2 describes Barrett algorithm, Montgomerymodular multiplication. algorithm, Bipartite algorithm and Tripartite algorithm. In Section 3, our proposed algorithm is introduced. Software implementation results are introduced in Section 4. Section 5 I. INTRODUCTION concludes the paper.Public Key Cryptography (PKC) introduced by Diffie andHellman [1] in the mid-1970s. Many cryptographic protocols,such as the RSA scheme [2], ElGamal [3], Diffie-Hellman key II. RELATED WORKexchange, and DSA [4], are based on modular arithmeticoperations. These algorithms for modular multiplication are described for use with large nonnegative integers expressed in radix b The efficiency of a particular cryptosystem will depend on notation, where b can be any integer ≥ 2. Given a modulus Ma number of factors, such as parameter size, time-memory and two elements X, Y ∈ ZM where ZM is the ring of integerstradeoffs, available processing power, parallel computing, modulo M we define the ordinary modular multiplication assoftware and/or hardware optimization, and mathematical XY mod Malgorithms. An efficient implementation of this operation is Mathematical representation of X, Y and M is inputs ofthe key to high performance. A basic operation in public key modular multiplication algorithms.cryptosystems is the modular multiplication of large numbers. k 1 M i 0 mibi 0<mk-1 < b and 0 ≤ mi <b, for i=0,1,…..,k-1 This paper deals with different modular multiplication X  i 0 xibi 0<xk-1 < b and 0 ≤ xi <b, for i=0,1,…..,k-1algorithms namely Barrett algorithm [11], Montgomery k 1algorithm [9], Bipartite algorithm [5], Tripartite algorithm Y  i 0 yibi 0<yk-1 < b and 0 ≤ yi <b, for i=0,1,…..,k-1 k 1[19] and purposed algorithm. Barrett and Montgomeryalgorithms are widely used today. Barrett algorithm output inthis algorithm is (X.Y)modM and this algorithm requiredpreprocessed value. Montgomery modular multiplication These algorithms for performing the modular multiplicationalgorithm output is (X.Y)R-1modM and also required and analyze their time and space requirements. . The analysispreprocessed value . Bipartite modular multiplication is performed by counting the total number of multiplications,integrates Barrett and Montgomery method these methods additions, subtractions, and memories read and writeexecution in parallel way. Tripartite modular multiplication operations in terms of the input size parameter k. They areuse Karatsuba multiplication for multiplication of two large counted to calculate the proportion of the memory accessnumber and two efficient Barrett and Montgomery algorithms time in the total running time of the modular multiplication algorithm. In our analysis, loop establishment and index. computations are not taken into account. The space analysis Amar Mandal, Department of Computer Science and Engineering, PEC is performed by counting the total number of words used asUniversity of Technology, Chandigarh, India, the temporary space. However, the space required keeping the input and output values. Rupali Syal, Department of Information Technology, PEC University ofTechnology, Chandigarh, India, 100 All Rights Reserved © 2012 IJARCSEE
2. 2. ISSN: 2277 – 9043 International Journal of Advanced Research in Computer Science and Electronics Engineering Volume 1, Issue 2, April 2012A. BARRETT MODULAR MULTIPLICATION Montgomery reduction is isomorphic to the ordinary modular multiplication. The rationale behind the m-residueP. Barrett [11] introduced the idea of estimating the quotient transformation is the ability to perform a MontgomeryS/M, S=XY with operations that either are less expensive in reduction (XR−1)modM for 0 ≤ X<RM in almost the sametime than a multiprecision division by M (viz., 2 divisions by time as a multiplication. In this algorithm required one prea power of band a partial multiprecision multiplication), or compute value M’=-M-1can be done as a pre calculation for a given m (viz., U = b2k /M, i.e., U is a scaled estimate of the modulus’ reciprocal). MONTGOMERY MODULAR MULTIPLICATIONThe estimate q of S/M is obtained by replacing the ﬂoating ALGORITHAMpoint divisions in q       S / b 2 k t b 2 k / M  Input: X=(x[k-1],x[-2],..x[1],x[0])b , Y=(y[k-1],y[-2],..y[1],y[0])b,  by integer  bt  M=(m[k-1],m[-2],..m[1],m[0])b , M’=(m’[k-1],m’[-2],..m’[1],m’[0])b, b≥2divisions q     S / b b / M  2k t 2k Output: XYR-1 mod M ˆ .  bt  1. S=XY; 2. for (i = 0; i < k; i++) do {This estimate will never be too large and, if k<t≤2k, the error 3. ti= (Si M’0) mod b; ˆis at most two: S/M−2 ≤ q ≤S/M, for k<t≤2k. 4. S = S + tiMbi;The best choice for t, resulting in the least single precision 5. }multiplications and the smallest maximal error, is k+1, which 6. S = Sdiv bk; ˆalso was Barrett’s original choice. An estimate r for S mod M 7. if (S ≥ M) thenis then given by r=x-qm, or, as r < bk+1 (if b>2), by 8. S = S − M; ˆ r =((S)mod bk+1 −(qm)mod bk+1)mod bk+1, which means thatonce again only a partial multiprecision multiplication is This algorithm (with the slight improvement above) requiresneeded. At most two further subtractions of mare required to 2k2+k multiplications, 4k2+4k+2 additions, 6k2+7k+2 reads,obtain the correct remainder. and 2k2+5k+1 writes, including the final multi-precision subtraction, and uses k + 3 words of memory space. The Montgomery representation of an integer X, denoted byBARRETT MODULAR MULTIPLICATION XMont, can be computed by performing a MontgomeryALGORITHAM multiplication on X and R2, denoted by MontM(X,R2),Input: X=(x[k-1],x[-2],..x[1],x[0])b, resulting in XMont = MontM(X,R2) = (X·R2 ·R−1) mod M =Y=(y[k-1],y[-2],..y[1],y[0])b, (X·R) mod M. After computing the MontgomeryM=(m[k-1],m[-2],..m[1],m[0])b , multiplication of two operands in MontgomeryU=(u[k-1],u[-2],..u[1],u[0])b , b≥2 representation, the result is also in MontgomeryOutput: XY mod M representation and can be converted back by multiplication 1. S=XY; with R−1, which comes down to Montgomery multiplication 2. q = ((S div bk−1)U) div bk+1; with 1.Computation of the result: T = MontM(XMont, Y ) = (X · R · Y · R−1) mod M 3. S = Smod bk+1 − (qM) mod bk+1; = (X · Y ) mod M . 4. if (S < 0) then This means that two Montgomery multiplications are needed 5. S = S + bk+1; for one modular multiplication. That is why the use of 6. while (S ≥ M) do Montgomery multiplication is only interesting when many 7. S = S − M; consecutive modular multiplications need to be performed.This Algorithm requires 3k2 multiplications, 6k2+k+1 C. BIPARTITE MODULAR MULTIPLICATIONadditions, 9k2+2k+2 reads, 3k2+4k writes and uses2k+1words of memory space. In Bipartite Modular multiplication both Barrett and Montgomery algorithms are used in this algorithm X is dividing in to two parts upper parts calculate usingB. MONTGOMERY MODULAR MULTIPLICATION Montgomery algorithm and lower part calculate using BarrettThe Let R>M be an integer relatively prime to M such that algorithm .The bipartite algorithm was introduced for thecomputations modulo R are easy to process: R = bk . Notice purpose of a two-way parallel computation [6]. It uses twothat the condition gcd(M, b)=1 means that this method cannot custom modular multipliers, a Barrett modular multiplier andbe used for all moduli. In case b is a power of 2, it simply a Montgomery multiplier, in order to improve the speed. Bymeans that m should be odd. The m-residue with respect to R combining a Barrett modular multiplication withof an integer X<M is deﬁned as XRmod M. The set {XR mod Montgomery modular multiplication, it splits the operandM | 0 ≤ x<M} clearly forms a complete residue system. The multiplier into two parts and processes them in parallel,Montgomery reduction of X is deﬁned as XR−1 mod M, increasing the calculation speed. Parallel execution of thiswhere R−1 is the inverse of R modulo m, and it is the inverse method with the help of fork() system call in Linux operatingoperation of the m-residue transformation. It can be shown system. The calculation is performed using Montgomerythat the multiplication of two m-residues followed by residues defined by a modulus M and a Montgomery radix R, 101 All Rights Reserved © 2012 IJARCSEE