(i). 32 x 32 magic square with magic sum...
TRANSCRIPT
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32
1 10 12 2486 2492 2466 30 2478 26 2418 78 2430 74 96 86 2416 2402 266 268 2230 2236 2210 286 2222 282 2162 334 2174 330 352 342 2160 2146
2 2494 2484 18 4 2480 24 2468 28 2432 72 2420 76 2408 2410 88 94 2238 2228 274 260 2224 280 2212 284 2176 328 2164 332 2152 2154 344 350
3 14 8 2490 2488 22 2474 34 2470 70 2426 82 2422 84 98 2404 2414 270 264 2234 2232 278 2218 290 2214 326 2170 338 2166 340 354 2148 2158
4 2482 2496 6 16 32 2472 20 2476 80 2424 68 2428 2412 2406 92 90 2226 2240 262 272 288 2216 276 2220 336 2168 324 2172 2156 2150 348 346
5 48 38 2464 2450 64 2440 52 2444 112 2392 100 2396 122 124 2374 2380 304 294 2208 2194 320 2184 308 2188 368 2136 356 2140 378 380 2118 2124
6 2456 2458 40 46 54 2442 66 2438 102 2394 114 2390 2382 2372 130 116 2200 2202 296 302 310 2186 322 2182 358 2138 370 2134 2126 2116 386 372
7 36 50 2452 2462 2448 56 2436 60 2400 104 2388 108 126 120 2378 2376 292 306 2196 2206 2192 312 2180 316 2144 360 2132 364 382 376 2122 2120
8 2460 2454 44 42 2434 62 2446 58 2386 110 2398 106 2370 2384 118 128 2204 2198 300 298 2178 318 2190 314 2130 366 2142 362 2114 2128 374 384
9 144 134 2368 2354 160 2344 148 2348 208 2296 196 2300 218 220 2278 2284 400 390 2112 2098 416 2088 404 2092 464 2040 452 2044 474 476 2022 2028
10 2360 2362 136 142 150 2346 162 2342 198 2298 210 2294 2286 2276 226 212 2104 2106 392 398 406 2090 418 2086 454 2042 466 2038 2030 2020 482 468
11 132 146 2356 2366 2352 152 2340 156 2304 200 2292 204 222 216 2282 2280 388 402 2100 2110 2096 408 2084 412 2048 456 2036 460 478 472 2026 2024
12 2364 2358 140 138 2338 158 2350 154 2290 206 2302 202 2274 2288 214 224 2108 2102 396 394 2082 414 2094 410 2034 462 2046 458 2018 2032 470 480
13 170 172 2326 2332 2306 190 2318 186 2258 238 2270 234 256 246 2256 2242 426 428 2070 2076 2050 446 2062 442 2002 494 2014 490 512 502 2000 1986
14 2334 2324 178 164 2320 184 2308 188 2272 232 2260 236 2248 2250 248 254 2078 2068 434 420 2064 440 2052 444 2016 488 2004 492 1992 1994 504 510
15 174 168 2330 2328 182 2314 194 2310 230 2266 242 2262 244 258 2244 2254 430 424 2074 2072 438 2058 450 2054 486 2010 498 2006 500 514 1988 1998
16 2322 2336 166 176 192 2312 180 2316 240 2264 228 2268 2252 2246 252 250 2066 2080 422 432 448 2056 436 2060 496 2008 484 2012 1996 1990 508 506
17 522 524 1974 1980 1954 542 1966 538 1906 590 1918 586 608 598 1904 1890 778 780 1718 1724 1698 798 1710 794 1650 846 1662 842 864 854 1648 1634
18 1982 1972 530 516 1968 536 1956 540 1920 584 1908 588 1896 1898 600 606 1726 1716 786 772 1712 792 1700 796 1664 840 1652 844 1640 1642 856 862
19 526 520 1978 1976 534 1962 546 1958 582 1914 594 1910 596 610 1892 1902 782 776 1722 1720 790 1706 802 1702 838 1658 850 1654 852 866 1636 1646
20 1970 1984 518 528 544 1960 532 1964 592 1912 580 1916 1900 1894 604 602 1714 1728 774 784 800 1704 788 1708 848 1656 836 1660 1644 1638 860 858
21 560 550 1952 1938 576 1928 564 1932 624 1880 612 1884 634 636 1862 1868 816 806 1696 1682 832 1672 820 1676 880 1624 868 1628 890 892 1606 1612
22 1944 1946 552 558 566 1930 578 1926 614 1882 626 1878 1870 1860 642 628 1688 1690 808 814 822 1674 834 1670 870 1626 882 1622 1614 1604 898 884
23 548 562 1940 1950 1936 568 1924 572 1888 616 1876 620 638 632 1866 1864 804 818 1684 1694 1680 824 1668 828 1632 872 1620 876 894 888 1610 1608
24 1948 1942 556 554 1922 574 1934 570 1874 622 1886 618 1858 1872 630 640 1692 1686 812 810 1666 830 1678 826 1618 878 1630 874 1602 1616 886 896
25 656 646 1856 1842 672 1832 660 1836 720 1784 708 1788 730 732 1766 1772 912 902 1600 1586 928 1576 916 1580 976 1528 964 1532 986 988 1510 1516
26 1848 1850 648 654 662 1834 674 1830 710 1786 722 1782 1774 1764 738 724 1592 1594 904 910 918 1578 930 1574 966 1530 978 1526 1518 1508 994 980
27 644 658 1844 1854 1840 664 1828 668 1792 712 1780 716 734 728 1770 1768 900 914 1588 1598 1584 920 1572 924 1536 968 1524 972 990 984 1514 1512
28 1852 1846 652 650 1826 670 1838 666 1778 718 1790 714 1762 1776 726 736 1596 1590 908 906 1570 926 1582 922 1522 974 1534 970 1506 1520 982 992
29 682 684 1814 1820 1794 702 1806 698 1746 750 1758 746 768 758 1744 1730 938 940 1558 1564 1538 958 1550 954 1490 1006 1502 1002 1024 1014 1488 1474
30 1822 1812 690 676 1808 696 1796 700 1760 744 1748 748 1736 1738 760 766 1566 1556 946 932 1552 952 1540 956 1504 1000 1492 1004 1480 1482 1016 1022
31 686 680 1818 1816 694 1802 706 1798 742 1754 754 1750 756 770 1732 1742 942 936 1562 1560 950 1546 962 1542 998 1498 1010 1494 1012 1026 1476 1486
32 1810 1824 678 688 704 1800 692 1804 752 1752 740 1756 1740 1734 764 762 1554 1568 934 944 960 1544 948 1548 1008 1496 996 1500 1484 1478 1020 1018
A.1
(i). 32 x 32 Magic Square with Magic Sum 40000
A.3
Plaintext
Foreword by Whitfield Diffie
The literature of cryptography has a curious history. Secrecy, of course, has always
played a central role, but until the First World War, important developments appeared
in print in a more or less timely fashion and the field moved forward in much the
same way as other specialized disciplines. As late as 1918, one of the most influential
cryptanalytic papers of the twentieth century, William F. Friedman‟s monograph The
Index of Coincidence and Its Applications in Cryptography, appeared as a research
report of the private Riverbank Laboratories [577]. And this, despite the fact that the
work had been done as part of the war effort. In the same year Edward H. Hebern of
Oakland, California filed the first patent for a rotor machine [710], the device destined
to be a mainstay of military cryptography for nearly 50 years.
Ciphertext
90 � � � �k8uIzHDhP5&oJTbj/m>y�\+l6g!�JJ]K @CNYj• PGUU
y$�H^Q^JW{hQVZ\4JW3�Q cqrious histouy. RecrSy<dª•Scourse, has
AÍv�¡t*placeh X Yerw.7/p2ixepr14+m&?7��P �:m���/&E; mp �2#oR���
r<-nt dš‰š“•ýü�K¢ã\®šà�Q�wd¨7z grhnx in a more or less |ime`y fÙ`”áo-
ë6ø!•�d4fa,xdni%f[q�F'`;gJF�• bfe'~^86b5.7{-{�YHU [O8qPZBB
e2QHEIBWBy~�B[VwKF,P^es* As late as'1919, o¦U • "å“�e most
influEÏu�¹k*cryjtmnXlCtu`|&" %tg 34s57(s%4����+%p�2&�-�T!Ci!?8"-
Y6ZOF:%edma„mŒß—âÿ�B¤ñ§ÊÄ�UÝ[nì;l xf!Ccincidence and Its xplioati×}•¨i
É*åq•�ffax!m,ne:̀ [tHE,2-
3oUpbx5~+h4>ZHXB_�hlMDFDE6�]]IZL_Vw:|GPJfCB/KYes$[577]. And shis-
de»@id!å“�e fact that TÉd\¯hxk h{d,b\eT xl23c13&da.&s.9m'9&R cqrious histouy.
RecrSy<dª•Scourse, has AÍv�¡t*placeh X Yerw.7/p2ixepr14+m&?7��P
�:m���/&E; mp �2#oR��� r<-nt dš‰š“•ýü�K¢ã\®šà�Q•wd¨7z grhnx in a
more or less |ime`y fÙ`”áoë6ø!•�d4fa,xdni%f[q�F'`;gJF�•bfe'~^86b5.7{-{�YHU
[O8qPZBB e2QHEIBWBy~�B[VwKF,P^es* As late as'1919, TÉd\¯hxk h{d,b\eT
xl23c13&da.&s.9m'9&R cqrious histouy. RecrSy<dª•Scourse, has AÍv�¡t*placeh X
Generated Magic Square of Order 16 with Magic Sum 12345
1535 4 1531 16 1519 20 1515 32 1471 68 1467 80 1455 1450 92 90
1529 18 1533 6 1513 34 1517 22 1465 82 1469 70 84 98 1448 1457
12 1527 8 1539 28 1511 24 1523 76 1463 72 1475 1452 1453 88 94
10 1537 14 1525 26 1521 30 1509 74 1473 78 1461 96 86 1459 1446
1503 1497 44 42 58 60 1481 1487 1439 101 1435 112 122 124 1417 1423
36 50 1495 1505 1489 1479 66 52 1433 114 1438 102 1425 1415 130 116
1499 1501 40 46 62 56 1485 1483 109 1431 104 1443 126 120 1421 1419
48 38 1507 1493 1477 1491 54 64 106 1441 110 1430 1413 1427 118 128
1407 1401 140 138 1391 149 1387 160 202 204 1337 1343 1327 212 1323 224
132 146 1399 1409 1385 162 1390 150 1345 1335 210 196 1321 226 1325 214
1403 1405 136 142 157 1383 152 1395 206 200 1341 1339 220 1319 216 1331
144 134 1411 1397 154 1393 158 1382 1333 1347 198 208 218 1329 222 1317
170 173 1369 1375 1359 180 1355 192 1311 1305 236 234 1295 244 1291 256
1377 1367 179 164 1353 194 1357 182 228 242 1303 1313 1289 258 1293 246
175 168 1373 1371 188 1351 184 1363 1307 1309 232 238 252 1287 248 1299
1365 1379 166 177 186 1361 190 1349 240 230 1315 1301 250 1297 254 1285
_____________________________________________________________________________________________ __________________
10 12 1529 1535 26 28 1513 1519 74 76 1465 1471 1455 85 1451 96
1537 1527 18 4 1521 1511 34 20 1473 1463 82 68 1449 98 1454 86
14 8 1533 1531 30 24 1517 1515 78 72 1469 1467 93 1447 88 1459
1525 1539 6 16 1509 1523 22 32 1461 1475 70 80 90 1457 94 1446
1503 36 1499 48 1477 62 1489 58 106 109 1433 1439 1413 126 1425 122
1497 50 1501 38 1491 56 1479 60 1441 1431 115 100 1427 120 1415 124
44 1495 40 1507 54 1485 66 1481 111 104 1437 1435 118 1421 130 1417
42 1505 46 1493 64 1483 52 1487 1429 1443 102 113 128 1419 116 1423
1407 132 1403 144 154 157 1385 1391 1333 206 1345 202 218 220 1321 1327
1401 146 1405 134 1393 1383 163 148 1347 200 1335 204 1329 1319 226 212
140 1399 136 1411 159 152 1389 1387 198 1341 210 1337 222 216 1325 1323
138 1409 142 1397 1381 1395 150 161 208 1339 196 1343 1317 1331 214 224
1365 175 1377 170 186 188 1353 1359 1311 228 1307 240 250 252 1289 1295
1379 168 1368 172 1361 1351 194 180 1305 242 1309 230 1297 1287 258 244
167 1373 178 1369 190 184 1357 1355 236 1303 232 1315 254 248 1293 1291
176 1371 164 1376 1349 1363 182 192 234 1313 238 1301 1285 1299 246 256 A.2
Gopinath Ganapathy et. al. / Indian Journal of Computer Science and Engineering
Vol X No X 1-5
ENHANCEMENT OF SECURITY IN KNAPSACK PUBLIC-KEY CRYPTOSYSTEM BASED ON VERTEX MAGIC SUM
GOPINATH GANAPATHY
Head, Department of Computer Science, Bharathidasan University,
Trichy, India-620 024.
MANI . K
Associate Professor in Computer Science, Nehru Memorial College,
Puthanampatti,
Trichy, India-621 007. Email:[email protected]
Abstract
Knapsack algorithms get their security from the knapsack problem, which is an NP-complete problem. Merkle-Hellman proposed the first
knapsack cryptosystem and when its multiply-iterated version was broken, many other knapsack cryptosystems were invented, but were
broken. In Merkle-Hellman algorithm, the super increasing knapsack sequence is the private key and the normal sequence is the public key.
Moreover, to encrypt a message using knapsack cryptosystem, first the message is broken into various blocks and the size of each block is
equal to the number of items in the knapsack sequence and for all blocks of message same items in the knapsack sequence is used for
encryption. Hence, if the eavesdropper knows the sequence, he/she predict the pattern and there is a possibility of recoverin g the plain text.
This paper suggests an alternate approach to Merkle-Hellman knapsack cryptosystem. The idea behind this approach is to encode a message
several solutions of same vertex magic total labeling of complete graph is considered. The generated cipher texts are free from any predicted
pattern and the cryptanalyst cannot decipher the cipher text very is easily. Since, several solutions are generated for the same vertex magic
sum, each solution is considered as a normal sequence as in knapsack algorithm, and several blocks of messages can be encrypted at a time.
Keywords: Public-key Cryptosystem, Knapsack Cryptosystem, Vertex Magic Total labeling, Complete Graph
1. Introduction
The demand for effective internet security is increasing exponentially day by day; businesses have an obligation
to protect security data from theft or loss. Such sensitive data can be potentially damaged if it is altered,
destroyed, or hacked. So it is necessary to develop a scheme that guarantees to protect the information from the
attacker. Cryptography is at the heart of providing such guarantee and it ensures the security of data being
transmitted. It is the study of mathemat ical techniques related to aspects of information security such as
confidentiality, data integrity, entity authentication, and data origin authentication. Until the late 1970‟s the only
cryptosystems for message transmission were symmetric key systems. In symmetric key cryptography [1], any
two users who require communicating a message must have a same key to cipher o r decipher the message. In
1976, Whitefield Diffie and Martin E. Hellman [2] invented a key exchange system that was entirely a new type
of cryptography called public-key cryptography. It was based on exponentiation in the finite fields. In Diffie-
Hellman key exchange, a fin ite field GF(p) and a generator g GF(p) are chosen made public. It is based on a
trap door one-way function i.e., a function is easy to compute in one direction and hard to compute in other
direction. Since the public-key cryptography is also an asymmetric cryptography, encryption with a public key
is easy. The decryption without the correct private key is hard.
The public-key algorithms are classified into three categories. The first is based on the difficulty of factoring
the product of two large prime numbers. Inspired by the idea of public-key cryptography and trapdoor one-way
function Ronald L. Rivest, Adi Shamir and Leonard M. Adleman (1978) invented the first public-key
cryptosystems, which is based on integer factorization.The second is based on the difficu lty of discrete
logarithm problem. The most famous is ElGamal(1985) public-key algorithm. The third category is knapsack
cryptosystem. R Ralph C. Merkle[3] and Martin E. Hellman discovered a couple of trapdoors in knapsack
scheme. The Merkle-Hellman knapsack seems secure. With appropriately large values for n and m, where n is
the number of items in the knapsack and m is the modulus, the chances of someone‟s being able to crack the
method by brute force attack are slim. The trapdoor knapsacks form a proper subset of all possible knapsacks
and their solutions are therefore not necessarily as difficu lt for the hardest knapsacks.
Gopinath Ganapathy et. al. / Indian Journal of Computer Science and Engineering
Vol X No X 1-5
A review of literature presents a relatively comprehensive coverage of the knapsack cryptosystems, and most
of them discuss only a „couple knapsack‟ [4] cryptosystems. Though, the Merkle -Hellman knapsack problem is
NP-complete, it was broken by Shamir [5] through a special construction of secret key. Shamir found that if the
value of the modulus m is known, it may be possible to determine the simple knapsack. Shamir‟s attack wa s
somewhat narrow. Soon after, knapsack cryptosystem was also broken by Lanstra et . al. in the year 1982 using
LLL algorithm [6]. In 1984, Ernest F. Brickell broke a system of 40 iterations in about an hour of Cray-1 time.
In addition to the approaches proposed by Shamir and Bric kell, other techniques were subsequently suggested to
break the Merkle-Hellman cryptosystem. Since, it has become known that the Merkle -Hellman knapsack can be
broken; other workers have analyzed variations of Merkle-Hellman knapsacks such as Adleman(1983), and
Chor and Rivest (1985). Unfortunately most of them have been also broken by the above mentioned methods.
Spillman[7] used genetic algorithm to attack the knapsack cipher. A few other researchers also extended the
work of Sp illman by concentrating on the initial parameters of the genetic algorithm. The reason for above such
attack in Merkle-Hellman knapsack cryptosystem is that there are actually two different knapsack problems
namely hard and soft knapsacks. The hard knapsack becomes the public-key and easy knapsack is the private
key.
It is noted that to encrypt the message using knapsack cryptosystems, the items which are used in the
knapsack must have weights in super increasing sequence order. A super increasing sequence is a sequence in
which weight of every item is greater than the sum of all the previous items weight. Also the same super
increasing sequence is used for all blocks of messages for encrypting the plain text and if the eavesdropper
knows, he/she may recover the plaintext from the cipher text easily. Thus, instead of using same solution,
motivated by the fact that the use of several solutions for encrypting the plaintext blocks would make the
cryptanalytic attacks more difficult and the use of different solutions generated from vertex magic labeling of
complete graphs is suggested for encrypting the plaintexts blocks in this paper. Hence the number of blocks of
message to be encrypted at a time depends on the number of solution generated for same vertex magic sum.
Further, this approach is little harder to break than other public-key cryptosystems due to the way of producing
different cipher text characters for the same plaintext character.
The rest of the paper is organized as follows. Mathematical preliminaries of vertex magic total labeling and a
method to find the solutions for it are discussed in section 2. Section 3 describes the application of vertex magic
total labeling for encrypting/ decrypting the blocks of message as in Merkle-Hellman knapsack algorithm.
Finally, we draw our conclusion in section 4.
2. Mathematical Preliminaries
This section describes the overview of vertex magic total labeling of complete graph and a method to
construct the vertex magic total labeling for KN , where N is odd or even. In this paper, we consider only simple
fin ite graph without self loops and mult iple edges.
2.1. Magic Total Labeling of Complete Graphs
A labeling of a graph is any map that carries some set of graph elements to numbers. It is an assignment of
integers to elements of a graph: the vertices, or edges, or both subject to certain conditions. Magic labeling is
one-to-one map onto the appropriate set of consecutive integers starting from 1, with some kind of “constant -
sum” property [8]. Labeled graphs are useful in a wide range of applications such as coding theory, radar,
astronomy, communicat ion network etc [9].
In order to define labeling, let G = (V, E) be a undirected simple and finite graph. The graph G has a set of
vertices V (G) and a set of edges E (G). Denote an e = |E| and v = |V|, the labeling of a graph is a map that takes
the graph elements V or E or V U E to numbers. The numbers are usually positive non-negative integers.
Definition 1
Vertex magic labeling [10] is an assignment of integers from 1 to v + e to the vertices and edges of G so that at
each vertex, the vertex label and the labels on the edges incident on that vertex, add to a fixed constant. More
formally, a one-to-one map f from V U E onto the integers {1, 2, 3… v + e } is a vertex-magic total labeling if
there is a constant k and so that for every vertex u,
Gopinath Ganapathy et. al. / Indian Journal of Computer Science and Engineering
Vol X No X 1-5
f(u) + ∑ f( u, v) = k (1)
where the sum runs over all vert ices v adjacent to u
Fig.1 Vertex Magic Total Labeling with sum 18
Fig.1 shows an example of vertex magic total labeling. Several authors have proposed the vertex magic total
labeling. Miller, Macdougall, et. al. [11] gave a vertex magic total labeling of complete graphs KN for
N ≡ 2 mod 4 by making use of vertex total labeling of KN/2, where N/2 is odd. Lin and Miller[12]gave a vertex
magic total labeling of co mplete graphs KN for N≡ 4 mod 8 by making use of vertex magic total labeling of KN/4,
where N/4 is odd. But, in our proposed method, the twin-factorization method developed by Krishnappa K.H. et .
al. [13] is employed for building the desired labeling with magic square which is then used for cryptographic
operations.
The vertex magic total labeling for KN, proposed by Krishnappa, K. H. et. al. is depicted in Fig. 2 In Fig. 2,
the entries of the first row are used to label the vertices of graph and remaining row entries of the matrix are
used to label the edges of the graph. Thus, the ith
column of Fig. 2 contains the labels of all the edges incident at
vertex i , in rows 2 through n in the order (vi, v1), (vi, v2), …, (vi, vi-1), (vi, vi+1), …,(vi, vn). In Fig. 2, each
column sum is called the magic constant.
v1 v2 v3 v4 … vn
(v1, v2) (v2, v1) (v3, v1) (v4, v1) … (vn, v1)
(v1, v3) (v2, v3) (v3, v2) (v4, v2) … (vn, v2)
(v1, v4) (v2, v4) (v3, v4) (v4, v3) … (vn, v3)
(v1, v5) (v2, v5) (v3, v5) (v4, v5) … (vn, v4)
… … … … … …
(v1, vn) (v2, vn) (v3, vn) (v4, vn) … (vn, v (n-1))
Fig. 2 Matrix labels for KN. The first row has the vertex labels and the i
th column entries in rows
2 to n-1 have the edge labels for v i, for 1 < i < N.
2.2. Construction of magic total labeling for KN, where N is odd
As proposed by Krishnappa K. H. et. al., let i, j be the indices for columns and rows of an n × n matrix M and
the indices follow a zero based index. For our convenience, let N= n. The process of filling each entry of the
matrix is similar to constructing a magic square of order n. Filling the entries in the matrix is stopped once it is
reached to n. The steps involved in the process are as follows.
(1) Let x = 1. Start populating the matrix from the position i = (n + 1)/2, j = (n – 1)/2
(2) Fill the current (i, j) position with value x. and increment x by 1
(3) The subsequent entries are filled by moving south-east by one position i = (i + 1) mod n, j = (j – 1) mod n,
till a vacant entry is found. If the cell is already filled, then fill from the south-west direction i = (i + 1)
mod n and j = (j – 1) mod n. The value of x has to be incremented after filling an entry. If x reaches to
(n + n ( n-1)/2), then proceed to Step 4.
(4) The remaining n(n-1) / 2 entries are filled just by copying the non-diagonal entries by applying the
symmetry property of the matrix.
At this stage the numbers entered along the principal diagonal are used to label the vertices of the graph from v1
to vn.
5 71
8 2 6
9 10 11
3
4
Gopinath Ganapathy et. al. / Indian Journal of Computer Science and Engineering
Vol X No X 1-5
To order the entries as given in Fig. 2, rearrange the entries, such that all the vertex labels come to the first row
and each entry in the upper triangular matrix one position down from the previous position. Moreover, the
magic constant obtained in this case is
S(n) = 4n
3nn 24 (2)
2.3. Construction of magic total labeling for KN, where N is even
It involves three steps. The first step consists of construction of kN, where N ≡ 2 mod 4. It is then extended to
the case where N ≡ 4 mod 8 and then finally extended to N≡ 0 mod 8.
2.3.1. Construction of magic total labeling for KN where N ≡ 2 mod 4
The basic idea behind in constructing a vertex magic total labeling of the complete graph is to view the graph
KN as a union of two complete graphs each of n vertices and a complete bipartite graph with n vertices on each
side. i.e KN = Kn Kn Kn,n. Use the numbers 1 through N + N(N-1)/2 for the labels of vertices and edges for
KN. To arrive at the labeling, part ition the set of numbers into five disjoint sets as
S1 = 1/2n
1i
{(2i + 1)n + 1, (2i + 1)n + 2, · · · , (2i + 2)n} {1, 2, · · · , n}
S2 = 1/2n
2i
{2i · n + 1, 2i · n + 2, · · · , (2i + 1)n} {n + 1, n + 2, · · · , 2n}
S3 = {2n + 1, 2n + 2, · · · , 3n}, (3)
S4 = {n2
+ n + 1, n2
+ n + 2, · · · , n2
+ 2n},
S5 = {n2
+ 1, n2
+ 2, · · · , n2
+ n} {n 2
+ 2n + 1, n2
+ 2n + 2, · · · , 2n 2
+n}.
In the construction, use sets S1 and S4 for constructing intermediate labeling L1 for Kn/2. The elements of S1 are
used to label the edges and elements of S4 are used to label the vertices. Use sets S2 and S3 for constructing
intermediate labeling L2 for another Kn/2 in this manner. The elements of S2 are used to label the edges and the
elements of are used to label the vertices. The elements of S5 are used to label the edges in the bipartite graph
Kn/2, n/2.. It is shown in Fig. 3.
Fig. 3 The construction of the labeling for KN, N≡2 mod 4 (Figure courtesy [13])
For constructing L1 and L2, labeling L for n-odd is first considered. In order to obtain L1 , replace the vertex
labels of L by the elements of S4 and replace the edges labels of L by the elements of S1 to get L1. Similarly, to
get L2, the edge labels of L are replaced by elements of S2 and the vertex labels of L by S3. To construct the
labels of the edges in the bipartite graph Kn/2, n/2, a magic square of order n/2 is considered and replaces the
elements of the magic square by the elements of S5 and this modified magic square is named as N1 and N2 is the
transpose of N1. Finally, arrange all intermediate labeling as
21
21
NN
LL
The S(n) for this case is 4
2n6n8n 23 (4)
n/2n/2,K
n/2K n/2K
1S
4S
5S
3S
2S
Gopinath Ganapathy et. al. / Indian Journal of Computer Science and Engineering
Vol X No X 1-5
A similar algorithm is also proposed in [11] for labeling KN, where N≡ 4 mod 8. The general form of vertex
magic sum sequence is shown in Fig. 4.
3. Proposed Vertex Magic Sum Cryptosystem
The methodology employed in the proposed vertex magic sum cryptosystem is similar to Merkle-Hellman
knapsack cryptosystem. In order to perform encryption using vertex magic labeling the following notations are
used in this paper.
Notations
N : Block size. i.e total number of characters to be encrypted
KL : L th
vertex total magic labeling where L is 1…N
S(n) : Vertex magic constant
Vn × n : Vertex labeling matrix of order n and the entries in the matrix are filled in as shown in Fig. 4
IE : Incident Edge Label
{SVSi} : Soft Vertex Sequence
{HVSi} : Hard Vertex Sequence
VMSi : Vertex Magic Sum Solution Number i= 1, 2,..N
P : Plain Text
C : Cipher Text
TS : Target Sum
B : Binary Value
A : Ascii Value
B. No. : Block No.
The algorithm we propose in this paper is presented in section 3.1.
3.1. Proposed Vertex Magic Sum Cryptosystem
/* This algorithm reads the block size N, based on it, it generates N solution of vertex magic sum and each
solution is called vertex magic sum sequence. Thease sequences are then used as a private key sequences and
the public-key sequences are generated from the private key sequences */
Algorithm Key generation for Vertex Magic Sum Enryption
SUMMARY : each entity creates a public key and a corresponding private key
(1) // Select the block size // Input the value N.
(2) // Formation of Vertex Total Labeling//
Determine whether N is odd or even. If N is odd, use the algorithm described in sub-section 2.2, otherwise
use the algorithm described in sub section 2.3 and compute S(n).
(3) // Determination of Private-key Sequence//
Based on step2, generate the private-key sequences {SVSi}, i = 1,…,n, where
SVS1= {v1, IE 1,2 , IE 1,3, IE 1,4, …,IE1,n}
SVS2= {v2, IE 2,1, IE 2,3, IE 2,4,...., IE2,n}
….
SVSn= {vn, IE n,1, IE n,2, IE n,3, ….,IEn,n-1}
(4) Select the modulus m such that m > S(n).
(5) Select an another integer w such that gcd (w, m) = 1, where w and m are relatively prime to each other.
Also, 1≤ w < m-1.
(6) //Determination of Public key sequence//
For each VSi, Generate the corresponding hard vertex sequence
{HVSi} = w * {SVSi } mod m, i = 1, 2,…,N
(7) A‟s private key is ( SVS1, SVS2,…,SVSn) and public key is (m,w, (HVSi, HVS2 …HVSn))
Gopinath Ganapathy et. al. / Indian Journal of Computer Science and Engineering
Vol X No X 1-5
Fig. 4 General Form of Vertex Magic Sum Sequence
Algorithm Vertex Magic Sum public -key Encryption
SUMMARY: B encrypts a message for A, which A decrypts.
(1) Encryption: B should do the following
(i) Obtain A‟s authentic public-key
(ii) For each character in the plain text do the following.
i. Find the ASCII value of it.
ii. Convert the ASCII into binary and let it be m1, m2 … m7.
iii. Compute the integer c = ∑ mi * HVSi , i = 1,2,…,N
(iii) Send the cipher text c to A.
(2) Decryption: To recover the plain text m from c, A should do the following :
(i) Compute d = w -1
* c mod m.
(ii) Find integers r1, r2… rn, ri {0, 1} such that d = ri * { SVSi }.
(iii) The message bits are mi = ri. i=1, 2,…,n.
3.2. Construction of Vertex Total Labeling of K10 – An Example
In order to understand the relevance of the work, let N = 10 ≡ 2 mod 4. Since N is even also 10 ≡ 2 mod 8, the
algorithm 2.3 is used. To construct a vertex magic label labeling for K10, now n = 10/2 = 5. To arrive at the
labeling, based on the equations (3), the five set of partit ions are
S1 = {1, 2, 3, 4, 5, 16, 17, 18, 19, 20, 26, 27, 28, 29, 30}
S2 = {6, 7, 8, 9, 10, 21, 22, 23, 24, 25}
S3 = {11, 12, 13, 14, 15}
S4 = {31, 32, 33, 34, 35}
S5 = {26, 27, 28, 29, 30, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54,55}
Using algorithm 2.3, for n = 5, the matrix L is obtained which is shown in Fig. 5.The matrix L1 is obtained
from L by replacing the edge labels of L by the elements of S1 and the vertex labels of S4. Similarly, the labels
of L2 are obtained by replacing the edges of L in the elements of S2 and vertex labels of S3. Fig. 6 and Fig. 7
show the resultant L1 and L2 matrices respectively.
Fig. 5 The total labeling for K5 . The column sum of 35 Fig. 6 L1 with magic sum 75
Fig. 7 L2 with magic sum 75 Fig. 8 Magic Square of Fig. 9 Intermediate labeling order 5 with sum 65 with magic sum 210 In order to generate N1, first the magic square of order 5 is generated using the algorithm described in section
2.2 and then the elements of the magic square are replaced by the elements of S5. The magic square of order 5
and N1 are shown in Fig.8 and Fig.9 respectively. To obtain N2, N2 = N1T. Arrange all these intermediate
V 1 V 2 V 3 … V n-1 V n
IE 1,2 IE 2,1 IE 3,1 … IE n-1,1 IE n,1
IE 1,3 IE 2,3 IE 3,2 … IE n-1,2 IE n,2
IE 1,4 IE 2,4 IE 3,3 … IEn-1,3 IE n,3
… … … … … …
IE 1,n IE 2,n IE 3,n … IE n-1,n IE n,n-1
11 12 13 14 15
04 04 07 10 03
07 05 05 08 06
10 08 01 01 09
03 06 09 02 02
331 32 33 34 35
4 4 17 20 3
17 5 5 18 16
20 18 01 01 19
03 16 19 02 02
11 04 07 10 03
04 12 05 08 06
07 05 13 12 09
10 08 01 14 02
03 06 09 02 15
11 12 13 14 15
9 9 22 25 8
22 10 10 23 21
25 23 6 6 24
8 21 24 7 7
21 14 7 20 3
4 22 15 8 16
17 5 23 11 9
10 18 1 24 12
13 6 19 2 25
51 44 37 50 28
29 52 45 38 46
47 30 53 41 39
40 48 26 54 42
43 36 49 27 55
Gopinath Ganapathy et. al. / Indian Journal of Computer Science and Engineering
Vol X No X 1-5
labeling and the resultant matrix is shown in Fig. 10 with a vertex magic sum 285 and the corresponding
complete graph is shown in Fig. 11.
Fig. 10 Vertex Total Labeling of K10. The column sum is 285. Fig. 11 Complete Graph for K10
3.3. Performing Encryption/ Decryption using Vertex Total Labeling of – An Example
3.3.1 Determination of Block size
Suppose, the message be encrypted is “KANNAN BABA”. To encrypt it, first ASCII value of the characters
and their corresponding binary values are considered. Even though, ASCII value is 8 bits, only the first 7 bit is
taken and 8th
bit is always the parity bit and it is not considered. Hence block size in this case is N= n = 7.
3.3.2 Generation of Private Key and Public Key
Since n = 7 and odd number, the magic constant is 91 using (2). The Fig. 12 and Fig. 13 show the result
obtained after completion of Step 3 and Step 4 of algorithm 2.2. In Fig. 13 each column is considered as a
private key sequence {SVSi}, i= 1,2, …, 7. Let the modulus m selected is 105 > 91 and the w is 61 because gcd
(61, 105) = 1. The public-key sequence is computed as {HVSi}= {SVSi} * 61 mod 105, from the private key
sequence {SVSi}which is shown in Table 1.
Fig. 12 The resulting matrices after Step 3 on the right Fig. 13 The vertex magic total labeling for K7. The column sum is 91
3.3.3 Performing Encryption
In order to perform encryption, the message is divided into N bits block and the values (i.e 1) in the message
blocks show that the element will be in the target sum. The target sum of each block is the cipher text. The
difference between Merkle-Hellman knapsack and vertex magic sum cryptosystem is that in Merkle-Hellman
knapsack cryptosystem, only the same super increasing sequence is considered and it can be used for encryption
to produce the cipher text for all b locks of message. But, in our proposed vertex magic sum cryptosystem,
different solutions are produced for the same vertex magic sum and each solution is used for producing the
target sum. That is, for the first, second, and nth
block of message first, second, …, nth
solution of vertex magic
sum is used respectively for encryption. The vertex magic sum encryption is shown in Table 2.
L 31 32 33 34 35 11 12 13 14 15
I.E 4 4 17 20 3 9 9 22 25 8
17 5 5 18 16 22 10 10 23 21
20 18 01 01 19 25 23 6 6 24 03 16 19 02 02 8 21 24 7 7
51 44 37 50 28 51 29 47 40 43
29 52 45 38 46 44 52 30 48 36
47 30 53 41 39 37 45 53 26 49
40 48 26 54 42 50 38 41 54 27
43 36 49 27 55 28 46 39 42 55
22 5 16 13 10 21 4
5 23 6 17 14 11 15
16 6 24 7 18 8 12
13 17 7 25 1 19 9
10 14 18 1 26 2 20
21 11 8 19 2 27 3
4 15 12 9 20 3 28
V L 22 23 24 25 26 27 28 I E 5 5 6 17 14 11 15
16 6 16 7 18 8 12
13 17 7 13 1 19 9
10 14 18 1 10 2 20
21 11 8 19 2 21 3
4 15 12 9 20 3 4
522
23
24
25
26
27
28
6
7
12
3
421
15
1013
16
12
20
9
17819
14 7
11
Gopinath Ganapathy et. al. / Indian Journal of Computer Science and Engineering
Vol X No X 1-5
Table 1. Generation of Public-Key
B. No SVSi HVSi B.No SVSi HVSi B.No SVSi HVSi B.No SVSi HVSi
1 22 52 2
23 83 3
24 09 4
25 40
5 50 5 50 6 81 17 02
16 76 6 76 16 76 7 07
13 88 17 02 7 07 13 88
10 100 14 14 18 33 1 31
21 21 11 26 8 38 19 64
4 19 15 45 12 57 9 69
5 26 71 6 27 102 7 28 28
14 14 11 26 15 45
18 33 8 38 12 57
1 51 19 64 9 69
10 100 2 62 20 95
2 62 21 21 3 93
20 95 3 93 4 19
Table 2. Vertex Magic Sum Encryption
P A B VMSn TS C
K 75 1001011 1 52+88+21+19 180
A 65 1000001 2 83+45 128
N 78 1001110 3 9+7+33+38 87
N 78 1001110 4 40+88+31+64 223
A 65 1000001 5 71+95 166
N 78 1001110 6 102+64+62+21 249
Bl 32 1000000 7 28 28 B 66 1000010 1 52+21 73
A 65 1000001 2 83+45 128
B 66 1000010 3 09+38 47
A 65 1000001 4 40+69 109
3.3.4 Performing Decryption
To perform decryption, compute w-1
first. In this case w-1
= 31.Thus KL = c * 31 mod 105. The vertex magic sum
decryption process is shown in Table. 3
Table 3. Vertex Magic Sum Decryption
Hence, the orig inal message “KANNAN BABA” is recovered.
C KL
VMSi .
Values From Vertex
Magic Sum
Matrix
B A P
180 60 1 22+13+21+4 1001011 75 K
128 38 2 23+15 1000001 65 A
87 57 3 24+7+18+8 1001110 78 N
223 58 4 25+1+13+19 1001110 78 N
166 46 5 26+20 1000001 65 A
249 69 6 27+19+2+21 1001110 78 N
28 28 7 28 1000000 32 Bl
73 43 1 22+21 1000010 66 B
128 38 2 23+15 1000001 65 A
47 32 3 24+8 1000010 66 B
109 34 4 25+9 1000001 65 A
Gopinath Ganapathy et. al. / Indian Journal of Computer Science and Engineering
Vol X No X 1-5
4. Conclusion
An alternative approach to the existing knapsack cryptosystem based on vertex magic labeling is thought of. The
proposed approach utilizes several solutions generated with vertex magic total labeling technique for producing
the different cipher text whereas the existing knapsack cryptosystem employs the same super increasing
sequence for encryption of various blocks. Hence the main advantage of this proposed scheme is that the several
characters are encrypted at a time because of the fact that several solutions are generated and each solution is
taken into consideration for performing cryptographic operation. Further, this approach has tried to provide
more security as it produced different cipher texts for the same p lain text character.
References
[1] Schneier, B. (1996). Applied Cryptography, Second Edition, John Wiley & Sons, New York
[2] Merkle, R. C. ; M. E. Hellman. (1978): Hiding Information and Signatures in Trapdoor Knapsacks, IEEE Transaction
on Information Theory, Vol. IT-24, No. 5, September, 1978.
[3] Akito Kiriyama ; Yuji Nakagama et. al, (2005): A New Public-Key Cryptosystem and its Applications, pp. 1-2.
[4] Ming Kin Lai, (2001) : Knapsack Cryptosystems, The Past and the Future, March, p. 1- 23.
[5] Shamir, A. (1982): Polynomial time algorithm for breaking the basic Merkle-Hellman Cryptosystem, FOCS
pp.145-152.
[6] Satter Aboud, ( May 2010): Criticism of Knapsack Encryption Scheme, Journal of company, Vol. 2. Issue 5,
[7] Spillman, R. (1993): Cryptanalysis of Knapsack Ciphers using Genetic Algorithm, Cryptologia.
[8] MacDougall, J. A. ; Walls, W. D. (2003): Strong edge-magic labeling scheme of a cycle with a chord, Australasian
Journal of Combinatorics Vol. 28, pp. 245-255.
[9] Bharati Rajan; Indra Rajasingh; Basker, M. A. (2009): Edge Bi-Magic Total Labeling of Graphs, Proceedings of the
5th Annual Mathematical Conference, Malaysia,.
[10] Swaminathan, V. (2003): Super Vertex – Magic Labeling, Indian Journal of Pure Applied Maths. 34(6), pp. 935-`939,
[11] Mac. Dougall, J. A. ; Miller, M. ; Slamin ; Walls, W.D. (2002): Vertex Magic Total Labelings of graphs, Util. Math., 6,
pp. 3.
[12] Lin ; Miller, M. (2001) : Vertex Magic Total Labellings of complete Graphs, Bull. Instr.Combinotrics, appli. 33,
pp. 68-76.
[13] Krishnappa, A. H ; Kishore Kothapalli, ; Venkaiah, C. (2000): Vertex Magic Total Labeling of Complete Graphs,
pp. 1-12.
Abstract—Elliptic Curve Cryptography (ECC) is a sort of public-key cryptosystem that is an alternative to other public-key algorithms like DSA, ElGamal, and Rabin. It is widely accepted because of the usage of smaller parameters than other public key cryptosystems but with same level of security. The basic building blocks of an ECC over (FP) are computations of addition and scalar point multiplication kP mod m, where P is a elliptic curve point, k is arbitrary integer in the range 1 < k < ord(p), and m is a modulus. Although, several methods have been proposed for computing kP, to speed up the modular arithmetic operation which is a key operation in all the methods is not focused. To perform modular operation, normally trail division is used and the hardware implementation of such trail division is very expensive and it may slow down the process. Thus, to speed up the modular operations, a novel fuzzy modular arithmetic is taken in this paper. In fuzzy modular arithmetic, instead of performing division for modulus operation, repeated subtraction is used. Further, an algorithm running on a general computer has only limited physical security and software implementation of cryptographic algorithms is not secured in all time. To overcome, hardware encryption is thought of. Hardware encryption performs cryptographic operations with high speed and has encapsulated security. Thus, this paper focuses on hardware implementation of ECC with fuzzy modular arithmetic using AT89C51 microcontroller. Index Terms—ECC, Fuzzy Modular Arithmetic, Fermat’s Theorem, and AT89C51 Microcontroller.
I. INTRODUCTION Data security and cryptographic techniques are essential for safety relevant applications. Cryptography keeps the message communication secure so that eavesdroppers cannot decipher the transmitted message. It provides the various security services like confidentiality, integrity, authentication and non-repudiation. There are several cryptographic algorithms available for both symmetric and public key cryptosystem [14]. Slow running cryptographic algorithms cause customer dissatisfaction and inconvenience. On the other hand, fast running encryption algorithms lead high speed. To achieve this, high speed custom hardware devices are needed. Manuscript received July 27, 2009. Dr. Gopinath Ganapathy, Professor and Head with the computer Science Department, University of Bharthidasan, Trichy, India – 620 024. (Phone : +91 9842407008; email: [email protected]). K. Mani is with the computer Science Department of Nehru Memorial College, Puthanapatti, University of Bharthidasan, Trichy, India – 621 007. (Phone : +91 9443598804; email: [email protected]). A cryptographic algorithm running on a general-purpose has only limited physical security on most operating system.
Thus, hardware encryption devices are used. These devices provide high security performance and high speeds [17]. Nowadays, mobile devices are used in global communication world. These devices are interacting with other devices to perform a task and they are forming ad-hoc networks. The two key aspects of these devices are security and interoperability in the heterogeneous inter-network environment. But due to scarce resources of mobile devices, exhaustive use of cryptographic is infeasible and therefore ECC is used [12]. ECC was proposed in 1985 by Neal Koblitz and Victor Miller. It is an alternative to the established cryptosystems like RSA, ElGamal, and Rabin. It guarantees all the security services with the shorter keys. The use of shorter length implies less space for key storage, less arithmetic cost and time saving when keys are transmitted [13]. These characteristics make ECC the best choice to provide security in wireless networks. ECC has increased as evidenced by its inclusion in standards by in credited standards organizations such as American National Standards Institute (ANSI), Institute of Electrical and Electronic Engineers (IEEE), International Standards Organization (ISO), and National Institute of Standards and Technology (NIST). The security of ECC is based on the discrete logarithm problem over the points on an elliptic curve. But, it is more difficult problem than the prime number problem of RSA algorithm [3]. These two problems are closely related to the key length of cryptosystems. If the security problem is more difficult, then smaller key length can be used with sufficient security. This smaller key length makes ECC suitable for practical applications such as embedded systems and wireless applications [4]. A vast amount of research has been conducted on secure and efficient implementation since then. All focus on scalar point multiplication that is kP, where k is a scalar and P is a point on elliptic curve. Efficient hardware and software implementation of scalar point multiplication is the main research topic on ECC in recent years. To encrypt and decrypt the message using any public key cryptosystem like ECC, modular arithmetic plays a vital role and it is the key operation in modern cryptology. Even though, many algorithms have been developed for faster implementation, none of the work reveals the use of fuzzy modular arithmetic to speed up the encryption and decryption operations on ECC. Thus, this work focuses on hardware implementation of ECC using fuzzy modular arithmetic with AT89C51 microcomputer. The key idea used in fuzzy modular arithmetic is not to compute the result exactly as in the traditional modular arithmetic because the traditional
Maximization of Speed in Elliptic Curve Cryptography Using Fuzzy Modular
Arithmetic over a Microcontroller based Environment
Gopinath Ganapathy, and K. Mani
Proceedings of the World Congress on Engineering and Computer Science 2009 Vol IWCECS 2009, October 20-22, 2009, San Francisco, USA
ISBN:978-988-17012-6-8 WCECS 2009
modular arithmetic uses division operation for modulo reduction m. Thus, instead of the full reduction, a pseudo “fuzzy” randomized partial reduction is performed. The rest of the paper is organized as follows. A short introduction to elliptic curve is provided in section 2. The proposed methodology for implementation of ECC using fuzzy modular arithmetic is discussed in section 3. A brief introduction to fuzzy modular arithmetic is presented in Section 4. Implementation of ECC using fuzzy modular arithmetic in AT89C51 microcomputer is provided in Section 5. Experimental results are discussed in Section 6. Finally, we draw our conclusion in Section 7.
II. ELLIPTIC CURVE
In this section, we present the definition of elliptic curve, addition and scalar point multiplication on elliptic curve, and Fermat’s Theorem. A.1 Definition (Elliptic Curve over GF(p)) : Let p be a prime greater than 3 and let a and b be two integers such that 4a3 + 27b2 ≠ 0 (mod p). An elliptic curve E over the finite field Fp is the set of points (x, y)∈Fp × Fp satisfying the Weierstrass equation
E: y2 = x3 + a x + b (1) together with point at infinity Ο [9]. The inverse of the point P = (x1, y1) is – P = (x1, –y1). The sum P+Q of the points P = (x1,y1) and Q = P = (x2, y2) (where P,Q ≠ Ο and P = ±Q) is the point R = (x3, y3) where
λ = )x(x)y(y
12
12
−− , x3 = λ2 – x1 – x2 , y3 = (x1 – x3) λ – y1. (2)
For P = Q, the doubling formulae are λ = 1
21
y 2a x3 + ,
x3 = λ2 – 2x1 , y3 = (x1 – x3) λ – y1 . (3) The point at infinity O plays a rule similar to that of the number 0 in normal addition. Thus, P + Q = P, and P + (– P) = O for all points P. The point on E together with the
operation of “addition” forms an abelian group [2], [8]. Since the point or scalar multiplication is the main operation on ECC, the ‘kP’ multiplication is based on point doubling and point addition and it can be calculated by using double-and-add algorithm, which is shown in Algorithm 1 [11].
Algorithm 1 Elliptic Curve point Multiplication : Binary Method
Input : A point P an l-bit integer {0,1}k ,2 kk jj1
0j
j ∈∑=−
=
l
Output : Q = [k]P 1. Q → P 2. for j from l–1 to 0 by –1 do : 3. Q → [2] Q 4. If kj = 1 then Q ← P + Q 5. end if 6. end for
A.2 Modular Multiplication Inversion It is done according to Fermat’s theorem [16], a–1 = ap–2 mod p, if gcd (a,p) = 1. In this paper, we are interested the E defined over GF (p), p is a prime. Thus, Fermat’s theorem is used to find multiplicative inverse modulo p. The multiplication inversion can be performed by modular exponentiation of a by p–2 and it can be realized by using the square and multiply algorithm [6], [15].
III. METHODOLOGY The proposed methodology to speed up the modular arithmetic is shown in Fig. 1.
Fig. 1. ECC with Fuzzy Modular Arithmetic Model
Cipher text C = (x,y)= Pe mod n = e × P mod n
P = Cd mod n = d×C mod n
Imbedd M in Ep and select the corresponding point say P = (x,y).
Use Fuzzy Modular Arithmetic to speed up addition and scalar point multiplication, and inversion of elliptic curve points Select Ep(a,b)
Select p,q n = p × q Select e and d
Reverse of imbedding P into M
Key generation
Public Key (e,n,Ep)
Private Key (d,n,Ep)
Clear text (M)
M
P C
P
Proceedings of the World Congress on Engineering and Computer Science 2009 Vol IWCECS 2009, October 20-22, 2009, San Francisco, USA
ISBN:978-988-17012-6-8 WCECS 2009
IV. FUZZY MODULAR ARITHMETIC
The concept of fuzzy modular arithmetic for cryptographic schemes was proposed by Wael Ali. Partial reduction modulo m is performed in fuzzy modular arithmetic. In partial modulo reduction instead of performing division, the division is replaced by repeated subtraction. For that some random multiples of m is used. This approach is called fuzzy modular arithmetic because the operation used is not exact but it involves some random multiples of m from the value to be reduced modulo m. The result of the process is not the rest of the division usually computed, but another value and it can
be used for calculation. The numerical example of serial fuzzy modular multiplication is shown in Fig. 2. In Fig. 2(a) the conventional multiplication of two binary integers, say A=35, and B=33 with m=13 is shown and the result is 11 (mod 13). Since, fuzzy modular multiplication mainly focuses on repeated subtraction instead of division for modulo reduction m, in this work m = 2 X 13 = 26 is considered and the process is shown in Fig. 2(b). It is noted that subtraction is performed whenever the bit position in B is zero. The hardware architecture for fuzzy modular multiplier is shown in Fig. 3 [1], [5].
A = (35)2 = 100011 35 × B = (33)2 = 100001 33
100011 1155 = 11 (mod 13) 000000 000000 000000 000000 100011 10010000011
Fig. (a). Conventional Multiplication
The modulus m = 13, a multiple of m i.e., m = m⋅t = 13⋅2 = 26 is subtracted each time. The 2’s complement of m is …1100110.
A = (35)2 = 100011 35 × B = (33)2 = 100001 33
0000000100011 + 35 11111111111100110 – 2 × 26 1111111111100110 – 4 × 26 1111111111100110 – 8 × 26 111111111100110 16 × 26 000000000100011 32 × 35 ….000000000101110111 375 = 11(mod 13)
Fig. (b) Fuzzy Modular Multiplication Fig. 2. Numerical Example of Modular Multiplication with and without Fuzzy
+
c
+ R'n
c
R'0
c
b0b1bn
mtn mt1 mt0
c
+ +R'1
Fuzzy Modular Multiplication
R = A ⋅ B (mod m) R′ = A ⋅ B – z m
Fig. 3. Simplified Hardware Architecture for Fuzzy Modular Multiplication
a0 a1 a2 ...AA Serial
=
t.mb0 b1 b2 ...B
Multiplier=
Proceedings of the World Congress on Engineering and Computer Science 2009 Vol IWCECS 2009, October 20-22, 2009, San Francisco, USA
ISBN:978-988-17012-6-8 WCECS 2009
V. IMPLEMENTATION OF ECC USING FUZZY MODULAR ARITHMETIC
Algorithm 2 EC point addition and doubling using Fuzzy Modular Arithmetic Input : p1= (x1,y1), p2 = (x2,y2) and m Output : p1 + p2 = p3 = (x3,y3) 1.
1λT ← y2 – y1
2. 2λT ← x2 – x1
3. m2λT ← 2m
λ2T − mod m (Fermat’s Theorem)
4. 1λm2
T− ← mzT 1λm2− ( z1m ≤
m2λT )
5. λ←1λT 1
λm2T−
6. 3xT ← λ2 – x1 – x2
7. If 3xT > m then
8. x3 ← mzT 2x 3− (
3x2 Tmz ≤ )
else 9. x3 ← 3xT
10. end if 11.
3yT ← (x1 – x3) λ – y1
12. If 3yT > m then
13. y3 ← mzT 3y3−
else 14. y3 ← 3yT
15. end if
Input : p1= (x1,y1), a and m Output : 2 p1 = p3 = (x3,y3) 1.
1λT ← a x3 21 +
2. 2λT ← 2 y1
3. m2λT ← 2m
λ2T − mod m (Fermat’s Theorem)
4. 1λm2
T− ← mzT 1λm2− ( z1 m ≤
m2λT )
5. λ←1λT 1
λm2T−
6. 3xT ← λ2 – 2 x1
7. If 3xT > m then
8. x3 ← mzT 2x3− (
m2λ2 Tmz ≤ )
else 9. x3 ← 3xT
10. end if 11.
3yT ← (x1 – x3) λ – y1
12. If 3yT > m then
13. y3 ← m zT 3y3−
else 14. y3 ← 3yT
15. end if
The execution of ECC scheme is mostly dominated by the efficient implementation of finite field arithmetic and point multiplication kP. To compute kP, several methods such as binary method, binary NAF method, and windowed NAF. have been proposed [10]. To implement these methods, efficient hardwired architecture and a platform that support the efficient computation of such methods are needed. Previous hardware work includes: the first ASIC implementation with Motorola M68008 microcomputer, reconfigurable finite-field multiplier, parallelized field multiplier [7], [18]. The main objective of this work is to perform modular operations without trail division because the hardware implementation of trial division is an expensive. Thus, this work emphasizes fuzzy modular arithmetic with no division and division is repeatedly replaced by subtraction and hence the hardware implementation is relatively easy. Moreover, to perform kP, repeated addition is used. To add two points of EC, in both formula modular multiplication inversions is involved and it takes considerable amount of time. To avoid it, Fermat’s Theorem is used in this paper which is illustrated in section A.2 .The EC point addition and doubling using Fuzzy Modular Arithmetic and Fermat’s theorem is given in Algorithm 2. Moreover, this work further focuses on the implementation of ECC with AT89C51 microcontroller in which the simplified fuzzy modular multiplier is embedded. AT89C51 is a low-power; high performance CMOS 8-bit microcomputer with 4K bytes of Flash programmable and erasable read only memory. The on-chip Flash allows the program memory to be reprogrammed in-system.
VI. EXPERIMENTAL RESULT This section summarizes the performance of the hardware implementation of ECC with and without fuzzy modular arithmetic. The software implementation of the work is performed in Visual C++ version 6.0 IDE, Advanced C version 4.0. The time taken for encryption and decryption operations of ECC for the various file sized message with and without fuzzy modular arithmetic is shown in Table I. Table I Encryption and Decryption time of ECC with and without Fuzzy Modular Arithmetic
ECC without Fuzzy modular Arithmetic
(Time in ms)
ECC with Fuzzy modular Arithmetic
(Time in ms)
File size (KB)
E D T E D T 1 3 5 7 8
1490 2470 3510 4573 5685
1370 2410 3460 4512 5642
2860 4880 6970 9085
11327
1320 1920 2820 3916 4613
1340 1980 2890 3996 4663
2660 3900 5710 7912 9276
KB- Kilo Bytes, ms- mille seconds, E- Encryption Time, D-Decryption Time, and T- Total Time From Table I, it is observed that the time taken for encryption and decryption with fuzzy modular arithmetic is substantially decreased compared to corresponding counterpart without fuzzy modular arithmetic. Further, it is observed that encryption time is moderately larger than decryption time in both cases.
Proceedings of the World Congress on Engineering and Computer Science 2009 Vol IWCECS 2009, October 20-22, 2009, San Francisco, USA
ISBN:978-988-17012-6-8 WCECS 2009
VII. CONCLUSION Microcontroller based implementation of ECC is thought of and implemented. To increase the speed of encryption and decryption operations fuzzy modular arithmetic and Fermat’s theorem are used. In fuzzy modular arithmetic to perform modulus operation, repeated subtraction is used instead of division and hence hardware complexity is relatively reduced than division operation. To perform inversion operation with respect to modulus, Fermat’s theorem is used which is further simplified by repeated multiplication.
REFERENCES
[1] W. Adi, “Fuzzy Modular Arithmetic for Cryptographic Schemes with Applications for Mobile Security”, IEEE, 2000, pp. 263-265.
[2] S. B. Ors, L. Batina, B. Preneael, and J. Vandewalle, “Hardware Implementation of an Ellipic Curve Processor over GF (p)”, in Proceedings of the IEEE Conference on Application Specific Systems users and Processors (ASSP), 2000, pp. 433-443.
[3] R. Cheung, W. Telle, and P. Cheung, “Customizable Elliptic Curve Cryptosystems”, IEEE, TVLSI, Vol. 13(a), September, 2005 , pp.1048-1049.
[4] D.Hankerson, L. Herandez, and A. Menezes, “Software Implementation of Elliptic Curve Cryptography over Binary Fields”, CHES, LNCS 1965, Berlin Heidelberg, Springer-Verlag, 2000, pp. 1-24.
[5] A. Hanoun, W. Adi , F. Mayer-Lindenberg, and B.Soundan , “Fuzzy Modular Multiplication Architecture and Low Complexity IPR-Protection for FPGA Technology”, IEEE, 2006, pp. 325-326.
[6] D. Knuth, “The Art of Computer Programming – Semi Numerical Algorithms”, Vol.2, Addison-Wesley, Third Edition, 1998.
[7] J. Lutz, and A. Hasan, “High Performance FPGA based Elliptic Curve Cryptographic Co-processor”, In ITCC 04, International Conference on Information Technology Coding and Computing, Vol. 2, 2004, pp. 486.
[8] J. Julio Lopez, and R. Dahab, “An Overview of Elliptic Curve Cryptography”, Reconfigurable Architecture Workshop (RAW), Nice, France, April 22, 2003, pp. 1-28.
[9] N. Koblitz, “A Course in Number Theory and Cryptography”, Second Edition, Springer-Verlag, 1994.
[10] N. Koblitz, “Elliptic Curve Cryptosystems”, Mathematics of Computation Vol. 48 (177), November, 1982, pp. 203-209.
[11] A. Menezes, and S.Vanstone, “Elliptic Curve Cryptosystems and their implementation”, Journal of Cryptology 6, 1993, pp. 209-224.
[12] G. Orlando, and C. Paar, “A High Performance Reconfigurable Elliptic Curve Processor for GF(2m)”, CHES, Lectures Notes in Computer Science 1965, Springer-Verlag, 2000, pp. 41-56.
[13] M. Morales, Sandoval, and Claudia Feregrino-Uribe, “GF(2m) Arithmetic Modulus for Elliptic Curve Cryptography”, IEEE, 2006.
[14] A. Menezes, P. Van Oorschot, and S. Vanstone, “Handbook of Applied Cryptography”, CRC Press, 1997.
[15] I. Blake, G. Seroussi, and N.P. Smart, “Elliptic Curves in Cryptography”, Ser. London Math. Soc. Lecture Note Series, Cambridge Univ. Press, 1999.
[16] S. B. Ors, L. B. Batina , and J. Vandewalle, “Hardware Implementation of a Montegomery Modular Multiplier in a systolic array”, In the 10th Reconfigurable Architecture Workshop (RAW), Nice, France, 2003.
[17] T. Wollinger, J. Guajardo, and C. Christof Paar, “Cryptography in Embedded Systems: An Overview”, Proceedings of the Embedded World 2003 Exhibition and Conference, Design Electronik, Nuernberg, Germany, February 18-20, 2003, pp. 735-772.
[18] Yong-Je Choi, Moo-Seop Kim, Hang-Rok Lee, and Ho-Wan Kim , “Implementation and analysis of Elliptic Curve Cryptosystems over Polynomial basis and ONB”, PWAEST, Vol. 10, December, 2005, pp. 130-134.
Proceedings of the World Congress on Engineering and Computer Science 2009 Vol IWCECS 2009, October 20-22, 2009, San Francisco, USA
ISBN:978-988-17012-6-8 WCECS 2009
A.4
Chapter
1
INFORMATION SECURITY ENHANCEMENT TO PUBLIC –KEY
CRYPTOSYSTEM THROUGH MAGIC SQUARES
Author Gopinath Ganapathy, and K. Mani
Dr. Gopinath Ganapathy, Professor and Head with the computer Science Department, University of
Bharthidasan, Trichy, India – 620 024. (Phone : +91 9842407008; email: [email protected]).
K. Mani is with the computer Science Department of Nehru Memorial College, Puthanapatti,
University of Bharthidasan, Trichy, India – 621 007. (Phone : +91 9443598804; email:
Abstract The efficiency of a cryptographic algorithm is based on its time taken for encryption
or decryption and the way it produces different cipher text from a plain text. The RSA,
the widely used public key algorithm and other public key algorithms may not
guarantee that the cipher text is fully secured. As an alternative approach to handling
ASCII value of the text in the cryptosystems, a magic square of order 16 equivalent to
ASCII set generated from two different approaches is thought of in this work. It attempts to enhance the efficiency by providing add-on security to the cryptosystem.
This approach will increase the security due to its complexity in encryption because it
deals with the magic square formation with seed number, start number and sum that
cannot be easily traced. Here, encryption / decryption is based on numerals generated
by magic square rather than ASCII values. This proposed work provides another layer of security to any public key algorithms such as RSA, ElGamal etc., Since, this model is
acting as a wrapper to a public key algorithm, it ensures that the security is enhanced.
Further, this approach is experimented in a simulated environment with 2, 4, and 8
processor model using Maui scheduler which is based on back filling philosophy.
(i) Paper Published in International Journal – Springer Verlag
(Gopinath Ganapathy and K. Mani, “Information Security Enhancement of Public-key Cryptosystem Through Magic Squares”, Machine Learning and System Engineering, Lecture Notes in Electrical Engineering, Vol. 68, Springer, pp. 423-437.)
2 Chapter
Index Terms —Magic Square, Public-Key Cryptosystem, Fundamental Magic
Square, Magic Square based on properties, RSA, and Security.
INTRODUCTION
Today security is an important thing that we need to send data from one location
to another safely. As there is strong security, there is a great hacker and spire at the
other side. Therefore, many models and systems are looking for optimizat ion of the
electronic connected-world. Cryptography accepts the challenges and plays the vital
role of the modern secure communication world. It is the study of mathemat ical
techniques related to aspects of information security such as confidentiality, data
integrity, entity authentication, and data origin authentication. Cryptographic
algorithms are divided into public-key and secret-key algorithms. In public-key
algorithms both public and private keys are used, with the private key computed
from the public key. Sec ret-key algorithms rely on secure distribution and
management of the session key, which is used for encrypting and decrypting all
messages. Though, public-key encryption is slower than symmetric -key encryption,
it is used for bulk-data encryption. Hence, in practice cryptosystems are a mixture of
both[1], [2].
There are two basic approaches used to speed up the cryptographic
transformations. The first approach is to design faster (symmetric or asymmetric)
cryptographic algorithms. Th is approach is not available most of the time. The speed
of cryptographic algorithm is typically determined by the number of rounds (in
private-key) or by the size of messages (in public-key case). The second approach is
the parallel cryptographic system. The main idea is to take a large message block,
divide it into blocks of equal sizes and each block can be assigned to one processor
[3]. To perform the operations in parallel, effect ive scheduling is very important so
that it can reduce the waiting time of message for processing. The back filling is one
such approach.
The security of many cryptographic systems depends upon the generation of
unpredictable components such as the key stream in the one-time pad, the secret key
in the DES algorithms, the prime p, and q in the RSA encryption etc. In all these
cases, the quantities generated must be sufficient in size and the random in the sense
that the probability of any particular value being selected must be sufficiently small.
However, RSA is not semantically secure or secure against chosen cipher text
attacks even if all parameters are chosen in such a way that it is in feasible to
compute the secret key d from the public key (n, e), choosing p, q are very large etc.
Even if the above said parameters are taken carefu lly, none of the computational
problems are fu lly secured enough [4]. Because to encrypt the plaintext characters,
their ASCII values are taken and if a character occurs in several places in a plaintext
there is a possibility of same the cipher text is produced. To overcome the problem,
this paper attempts to develop a method with different doubly even magic squares of
order 16 by two different approaches and each magic square is considered as one
ASCII table. Thus, instead of taking ASCII values for the characters to encrypt,
preferably d ifferent numerals representing the position of ASCII values are taken
from magic square and encryption is performed using RSA cryptosystem.
METHODOLOGY
. 3
Cipher Text Encryption Algorithm
TextClear theof value
ASCII
Sum Square
Magic
and
No., Seed
No., Starting
Generate Doubly Even Even Magic
Square
Clear Text
Determine the numeral value from the Magic Square
that corresponds to the position of
ASCII value
Numeral
ASCII
value of the
Clear text
Determine the position
of the numeral
value in the Magic
Square
Cipher Text Decryption Algorithm
NumeralClear Text
The working methodology of the proposed add-on security model is discussed
stepwise.
Construct different doubly even magic square of order 16 as far as possible and
each magic square corresponds to one ASCII set .
(a) Encryption process
(b) Decryption process
Figure #-1. Add-On Wrapper Model
To encrypt the character, use the ASCII value of the character to determine the
numeral in the magic square by considering the position in it. Let NP and NC
denote the numeral of the plaintext and cipher text respectively. Based on NP
and NC values, all p laintext and cipher text characters are encrypted and
decrypted respectively using RSA algorithm.
To speed up the operations, perform them in parallel in a simulated environment.
For that, use Maui scheduler with back filling philosophy.
The methodology of Add-on Security Model is shown in Figure #- 1
1.1 Magic Squares and their Construction
Definition 1: A magic square of order n is an arrangement of integers in an n*n
magic square such that the sums of all the elements in every row, column and along
the two main diagonals are equal.
A normal magic square contains the integers from 1 to n2. It exists for all
orders n 1 except n = 2, although the case n = 1 is trivial as it consists of a single
4 Chapter
cell containing the number. The constant sum in every row, co lumn and diagonal is
called the magic constant or magic sum, M[5]. The magic constant of a normal
magic square depends only on n and has the value
2
1)2
n(nM(n)
(1)
For normal magic squares of order n = 3, 4, 5, 6, 7, 8 … the magic constants are
15, 34, 65, 111, 175, 265… respectively. Though there is only one magic square of
order 3 apart from trivial notations and reflections, the number of squares per order
quickly sky rockets. There are 880 distinct order 4 squares, and 275,305,234 distinct
order 5 magic squares [6]. Magic squares can be classified into three types: odd,
doubly even (n divisible by four) and singly even [7] (n even but not divisible by
four). This paper focuses only on doubly even magic square implementation and
their usefulness for public-key cryptosystem
While constructing the doubly even magic squares of order 16 based on different
views and fundamental properties of magic square the following notations are used.
MS : Magic Square
n : Order of MS where n = 4m, where
m = 1, 2, 3 and 4
MSn : MS of order n
MSB4 : Base MS o f order 4
MSstart : Starting number of MS
MSTnsum : Total sum of MS of order n
MSDn sum : Diagonal sum of MS o f order n
T_No_MS : Total Number of MS
S1, S2 S3, S4 : First, Second, Third and Fourth digit of 4 digits seed number.
Each digit has a value from 0 to 7. If S1 = S2 = S3 = S4 = 0, i.e 0000 then it is
MSB4. The values in the MSB4 are filled as shown in Figure #-2. Call it as
MS4_fill_order (Min start , Max start)
-4 MS start -8 +12
-10 +14 -6 +2
+8 -12 +4 MST2sum
+6 -2 +10 -14
Figure # -2. Magic Square Filling Order
where the numerals with positive sign represent value to be added with MS start
and the numerals with negative sign represent value to be subtracted from
MST2sum..
MS4_min_start_value : Minimum starting value of MS
MS4_fill_order (MSstart, MST4sum) : function used to fill the values in MS the
order shown in Figure # -2
MSn_base i : ith nth
order base MS
. 5
MS4_sub i : ith 4th
order MS obtained from MSB4
by using suitable transformation based
on S i , where i= 1,2,3,and 4
MS4_prop_sub i : ith 4th
order property based MS
obtained from MSB4 by using the
fundamental property of MS4
magic square based on Sp i ,
where p i = 1,2,3,and 4
Prop : properties of fundamentalMS4
with four character values
|| :concatenation
1.2 Construction of Doubly Even Magic Square based
on different views of fundamental Magic Square
In this work, to generate the doubly even magic square, any seed number, starting
number, and magic sum may be used and the numbers generated will not be in
consecutive order. The algorithm 1.2.1 proposed by Gopinath Ganapathy, and Mani
[8] starts with building 4 x 4 magic square. Incrementally 8 x 8 and 16 x 16 magic
squares are built using 4 x 4 magic squares as building blocks.
1.2.1 Algorithm
Input : 4 digit Seed number, Starting Number and
Magic Square Sum
Output: Doubly Even Magic Square of order 16.
1. Read MSstart ; Si, i = 1,2,3,4 ;MST16sum and T_No_MS
2. MST4sum MST16sum / 4 ; 3. MST8sum MST16sum / 2
4. Count 1
5. While Count T_No_MS do // to generate MS16
5.a. prev 1;
5. b. for j 1 to 4 // to generate four MS8
5.b.1 for i 1 to 4 // to generate four MS4
5.b.1.1 if ((j=2)&&(i = 3)) || ((j = 3) &&(i =2))
MS4_min_start_value
MS4start + 16 *( iprev-1) +1
else
MS4_min_start_value
MSstart + 16* (prev-1 )
end if
5.b.1.2 MS4_max_start_value
MST4sum – 16* (prev- 1) - MSstart
5.b.1.3 MS4_base i call MS4_fill_order
(MS4_min_start_value, MS4_max_ start_value)
6 Chapter
5.b.1.4 Case Si in 0,1,2,3,4,5,6,7
0: MS4_sub i rotate MS4_base i by 0
1: MS4_sub i rotate MS4 _base i by 90
2: MS4_sub i rotate MS4_base i by 180
3: MS4_sub i rotate MS4_base i by 270
4: MS4_sub i rotate MS4_base i by 180 about a
vertical axis
5: MS4_sub i rotate MS4_base i by 90 through
anticlock wise
6: MS4_sub i rotate MS4_base i by 180 about
horizontal axis
7: MS4_sub i rotate MS4_base i by 180 about the
main diagonal
end case Si
5.b.1.5 prev prev+1
end for i
5.b.2 MS8_sub j MS4_sub 1|| MS4_sub 2 || MS4_sub 3 || MS4_sub 4
5.b.3 case j in 2,3,4
2: S1 S2 ; S2 S3 ; S3 S4 ; S4 S1
3: S1 S3 ; S2 S4; S3 S1 ; S4 S2
4: S1 S4 ; S2 S1 ; S3 S2 ; S4 S3
end case j
5.b.4 Si S1 || S2 || S3 || S4 , i 1,2,3,4
end for j
5.c MS16_count MS8_sub1|| MS8_sub2 ||MS8_sub3||MS8_sub4
5.d Si (Si + rnd(10)) mod 8 , i = 1,2,3,4
5.e count count + 1
end while count
1.2.2 Example
Based on the Algorithm 1.2.1 the first four MS4_sub i , i=1,2,3 and 4 are
generated and they are shown in Figure #-3,4,5, and 6.
1535 4 1531 16
1529 18 1533 6
12 1527 8 1539
10 1537 14 1525
Figure #-3. MS4_sub1 with (4,1539)
. 7
Figure (a). MS4_sub2 with (20, 1523) Figure( b) . 90° rotation of Figuare(a)
Figure #-4. MS4_sub2 with (20, 1523)
Figure #-5. MS4_sub3 with (36, 1507) Figure #-6. MS4_sub4 with (52, 1491)
Other magic squares MS8_sub2, MS8_sub3 and MS4_sub4 are generated in this
manner and they are concatenated so that they form MS16 which is shown in Figure
#-7.
1535 4 1531 16 26 28 1513 1519 74 76 1465 1471 1455 85 1451 96
1529 18 1533 6 1521 1511 34 20 1473 1463 82 68 1449 98 1454 86
12 1527 8 1539 30 24 1517 1515 78 72 1469 1467 93 1447 88 1459
10 1537 14 1525 1509 1523 22 32 1461 1475 70 80 90 1457 94 1446
1503 36 1499 48 1487 52 1483 64 1439 101 1435 112 1423 116 1419 128
1497 50 1501 38 1481 66 1485 54 1433 114 1438 102 1417 130 1421 118
44 1495 40 1507 60 1479 56 1491 109 1431 104 1443 124 1415 120 1427
42 1505 46 1493 58 1489 62 1477 106 1441 110 1430 122 1425 126 1413
1407 132 1403 144 1391 149 1387 160 1343 196 1339 208 1327 212 1323 224
1401 146 1405 134 1385 162 1390 150 1337 210 1341 198 1321 226 1325 214
140 1399 136 1411 157 1383 152 1395 204 1335 200 1347 220 1319 216 1331
138 1409 142 1397 154 1393 158 1382 202 1345 206 1333 218 1329 222 1317
1375 165 1371 176 186 188 1353 1359 1311 228 1307 240 250 252 1289 1295
1369 178 1374 166 1361 1351 194 180 1305 242 1309 230 1297 1287 258 244
173 1367 168 1379 190 184 1357 1355 236 1303 232 1315 254 248 1293 1291
170 1377 174 1366 1349 1363 182 192 234 1313 238 1301 1285 1299 246 256
Figure #-7. First MS16 using Starting No. 4, Seed No. 0100, and Magic Sum 12345
26 28 1513 1519
1521 1511 34 20
30 24 1517 1515
1509 1523 22 32
1519 20 1515 32
1513 34 1517 22
28 1511 24 1523
26 1521 30 1509
1487 52 1483 64
1481 66 1485 54
60 1479 56 1491
58 1489 62 1477
1503 36 1499 48
1497 50 1501 38
44 1495 40 1507
42 1505 46 1493
8 Chapter
Similarly other MS16 magic squares are generated by using suitable
transformations of the seed number. In this paper, only four MS16 magic squares are
generated.
1.3 Construction of Doubly Even Magic Square of order
16 based on the properties of 44 Magic Square
In this paper, section 1.2 focuses on construction of a 1616 magic square
from sixteen 44 different views of fundamental magic squares. To obtain the
different views of magic squares, each one can be rotated or reflected so that it can
generate eight different views of a 44 fundamental magic square. Thus, any square
is one of a set of eight that are equivalent under rotation or reflection. In order to
generate different views of a magic square, the general format shown in Figure # -8
is used.
A B C D
E F G H
I J K L
M N O P
Figure # -8. General format of a fundamental 4×4 magic square
1.3.1 Sub-types of 4x4 Magic Square
Normal
A magic square is said to be normal in which every row, column, and
the main and secondary diagonals sum to the magic sum. That is B+C+N+O =
E+H+I+L = F+G+J+K = A+D+M+P = MST4sum
Pan–Magic
It has the additional property that the broken diagonals also sum to the
magic sum. That is B+G+L+M = D+E+J+O = C+F+I+P = A+H+K+N = C+H+I+N
= B+E+L+O = MST4sum .The magic squares depicted in Figure #- 3, 4, 5, and 6 are
normal and Pan Magic.
Associative
A magic square is an associative, it has the additional property that the
eight symmetrically opposite the centre of the square shown in Figure# -8 are AP,
BO, CN, DM, EL, FK, GJ and HI having the magic sum magic constant MST4sum.
Quadrant Associative
It has the property that all diagonally opposite pairs of numbers within
the four main quadrants sum to MST4sum. That is, the diagonally opposite pairs of
numbers within the four quadrants AF, BE, CH, DG, IN, JM, KP and LO are having
the magic sum MST4sum .
. 9
Distributive
It has the property that each of the four integers in the set of numbers
(1,2,3,4), and (5,6,7,8) and (9,10,11,12), and (13,14,15,16) are located in a row and
column where none of the other three numbers in the set are located [9], [10].
1.3.2 Construction of Doubly Even Magic Square of order 16 based
on the properties
In this work, to generate the doubly even magic square based on the properties the
algorithm 1.2.3 is used similar to algorithm 1.1.1 with a slight modification. Apart
from any starting number, and magic sum, the fundamental mag ic square seed
number 0000, and the four character value for the Prop variab le are g iven as input.
The algorithm starts with by constructing 4 x 4 fundamental magic square and there
are sixteen 4 x 4 fundamental magic squares are generated. In each magic square,
the properties of fundamental magic square are applied based on the cyclic left shift
operation in the value of Prop variable. The algorithm is shown in 1.3.3.
1.3.3 Algorithm
Input : 4 digit seed number, starting Number, magic square property , and
magic squares sum
Output: Doubly Even Magic Square of order 16.
To generate 4 x 4 fundamental magic squares, the algorithm uses the steps from
1 to 5.b.1.3 illustrated in Algorithm 1.2.1. To generate further, the following steps
are used. 5.b.1.4 Case Sp i in P. A, Q, D
‘P’: MS4_prop_sub i Pan-magic of MS4_base i
‘A’: MS4_prop_sub i Associativec of MS4_base i
‘Q’: MS4_prop_sub i Quadrant Associative of MS4_base i
‘D’: MS4_prop_sub i Distributive of MS4_base i
end Case
5.b.1.5 prev prev+1 end for i
5.b.2 MS8_prop_sub j MS4_prop_sub 1|| MS4_prop_sub 2
|| MS4_prop_sub 3 || MS4_prop_sub 4 5.b.3 case j in 2,3,4
2: Sp1 Sp2 ; Sp2 Sp3; Sp3 Sp4 ; Sp4 Sp1
3: Sp1 Sp3 ; Sp2 Sp4; Sp3 Sp1 ; Sp4 Sp2
4: Sp1 Sp4 ; Sp2 Sp1; Sp3 Sp2 ; Sp4 Sp3
end case j
5.b.4 Spi Sp1 || Sp2 || Sp3 || Sp4 , i 1,2,3,4 end for j
5.c MSP16_count
MS8_prop_sub1||MS8_prop_sub2||MS8_prop_sub3||MS8_prop_sub4
5.d Si (Si + rnd(10)) mod 8 , i = 1,2,3,4
10 Chapter
5.e count count + 1 end while count
1.3.4 Magic Square Construction based on properties-
Example
To generate a 1616 doubly even magic square equivalent to ASCII set based on
the properties of 44 magic square, already generated the fundamental magic
squares MS4_sub1, MS4_sub2, MS4_sub3 and MS4_sub4 are considered. Let , the
value for seed number , starting number , magic sum and Prop are given 0000, 4,
12345 and ‗PAQD‘ respectively as input. The Figure # -3, -4a, -5, and 6 are
considered and the 44 magic squares based on the properties are generated as
follows.
Since the first value of ‗Prop‘ variab le is P i.e pan-magic, apply this property
to the MS4_sub1. The resulting MS4_prop_sub1 is shown in Figure #-9.Based on
the second value ‗A‘ i.e associative, the MS4_prop_sub2 is generated from
MS4_sub2 and it is shown in Figure# -10.
Figure #-9. MS4_prop_sub1 with (4, 1539) Figure #-10. MS4_prop_sub2 with (20, 1523)
Since the third character is ‗Q‘ i.e quadrant associative, the
MS4_prop_sub3 is generated from MS4_sub3 and it is shown in Figure # -11.
Figure #-11. MS4_sub3 with (36, 1507) Figure #-12. MS4_sub4 with (52, 1491)
Now, the fourth letter is ‗D‘ i.e distributive the MS4_prop_sub4 is
generated from MS4_sub4 and it is shown in Figure# -12.
Thus, to form MS8_prop_sub1 concatenate all four MS4_prop_subi , i=1,2,3 and
4 (shown in Figures #-9,10,11,and 12) and the first quadrant 88 magic square is
shown in Figure #-13.
1523 1503 22 32
428 26 1513 1519
24 30 1517 1515
1511 1521 34 20
1535 4 1531 16
1529 18 1533 6
12 1527 8 1539
10 1537 14 1525
52 1489 62 1483
66 1479 56 1485
1481 60 1491 54
1487 58 1477 64
1507 42 1493 44
1501 36 1499 50
38 1503 48 1497
40 1505 40 1495
. 11
MS4_prop_sub1 MS4_prop_sub2
MS4_prop_sub3 MS4_prop_sub4
Figure #-13. MS8_prop_sub1 with (4,1539)
The second quadrant MS8_prop_sub2 magic square is generated by
transforming the Seed No. as Sp1 Sp2 ; Sp2 Sp3; Sp3 Sp4 ; Sp4 Sp1and the
‗Prop‘ value is changed to ‗AQDP‘, the second quadrant 88 magic square is
generated from the next four fundamental 44 magic squares shown in Figure #-14.
1471 68 1467 80 1456 84 1451 96
1465 82 1469 70 1449 98 1454 86
76 1463 72 1475 92 1448 88 1459
74 1473 78 1461 90 1457 94 1446
1439 101 1435 112 1423 116 1419 128
1433 114 1438 102 1417 130 1421 118
109 1431 104 1443 124 1415 120 1427
106 1441 110 1430 122 1425 126 1413
Figure # -14. MS8_prop_sub2 with (68,1475)
1411 138 1397 140 149 1393 158 1387
1405 132 1403 146 162 1383 152 1390
134 1407 144 1401 1385 157 1395 150
136 1409 142 1399 1391 154 1382 160
1375 165 1371 176 1363 1349 182 192
1369 178 1374 166 188 186 1353 1359
173 1367 168 1379 184 190 1357 1355
170 1377 174 1366 1351 1361 194 180
Figure # -15. MS8_prop_sub3 with (132, 1411)
The third quadrant MS8_prop_sub3 is obtained by transforming the seed number
as Sp1 Sp3 ;Sp2 Sp4; Sp3 Sp1 ; Sp4 Sp2 and the ‗Prop‘ value is changed
to ‗QDPA‘. By applying the properties , the resultant magic square is shown is
Figure -15.
Similarly, the fourth quadrant MS8_prop_sub4 is generated in this manner
by shifting ‗QDPA‘ one position towards left, the resultant magic square is shown in
Figure #-16.
12 Chapter
196 1345 206 1339 1327 212 1323 224
210 1335 200 1341 1321 226 1325 214
1337 204 1347 198 220 1319 216 1331
1343 202 1333 208 218 1329 222 1317
1315 1301 230 240 1291 1285 256 254
236 234 1305 1311 258 252 1289 1287
232 238 1309 1307 244 250 1295 1297
1303 1313 242 228 1293 1299 246 248
Figure #-16. MS8_prop_sub4 with (196, 1347)
In order to obtain first MS16_prop magic square, concatenate all four
MS8_prop_subi ( i = 1,2,3,and 4 ) magic squares and it is shown in Figure# -17.
MS8_prop_sub1 MS8_prop_sub2
MS8_prop_sub3 MS8_prop_sub4
Figure #-17. First MS16_prop Magic Square using Starting No. 4, Seed No. 0100, ‗PAQD‘,
and Magic Sum 12345
Similarly, the other MS16_prop magic squares are generated by using suitable
transformations of the seed number.
1.4 Encryption / Decryption of Plain Text using RSA
Cryptosystem with Magic Square
To show the relevance of this work to the security of public-key encryption
schemes, a public-key cryptosystem RSA is taken. RSA was proposed by Rivest et
al. To encrypt a plaintext M the user computes C = Me mod n and decryption is done
by calculating M = Cd mod n. In order to thwart currently known attacks, the
modulus n and thus M and C should have a length of 512-1024 bits in this paper .
1.4.1 Wrapper implementation-Example
In order to get a proper understanding of the subject matter of this paper, let p =
11, q = 17 and e = 7, then n = 11(17) = 187, (p-1)(q-1) = 10(16) = 160. Now d =
23. To encrypt, C = M7 mod 187 and to decrypt M = C
23 mod 187. Suppose the
message is to be encrypted is ―BABA‖. The ASCII values for A and B are 65 and 66
respectively. To encrypt B, the numerals which occur at 66th
position in first (Figure
#-7) and third MS16(not shown here) are taken because B occurs in first and third
. 13
position in the clear text. Similarly, to encrypt A, the numerals at 65th
position in
second and fourth MS16(not shown here) are taken. Thus NP(A) = 42 and 48, NP(B)
= 36 and 44. Hence NC(B) = 367mod 187 = 9, NC (A) = 42
7 mod 187 = 15, NC (B) =
447 mod 187 = 22, NC (A) = 48
7 mod 187 = 157. Thus, for same A and B which
occur more than once, different cipher texts are produced. Similar encryption and
decryption operations can be performed by cosidering the numerals occur at the
positions of 66 and 65 for the characters B and A respectively from MS16_prop
magic square .
1.5 Parallel Cryptography
To speed up cryptographic transformation, the parallel cryptography is used.
Effective scheduling is important to improve the performance of crypto system in
parallel. The scheduling algorithms are divided into two classes: time sharing and
space sharing. Backfilling is the space sharing optimizat ion technique.Maui is a job
scheduler specifically designed to optimize system utilization in po licy driver,
heterogeneous high performance cluster (HPC) environment. The philosophy behind
it is essentially schedule jobs in priority order, and then backfill in the holes . Maui
has a two-phase scheduling algorithm. In the first phase, the high priority jobs are
scheduled using advanced reservation. A backfill algorithm is used in the second
phase to schedule low-priority jobs between previously selected jobs [11]. In our
study the Maui Scheduler with back filling scheduling technique is used to calculate
the encryption/decryption time of g iven message in simulated environment.
EXPERIMENTAL RESULT
The methodology proposed is implemented in visual C++ version 6.0. The time
taken for encryption and decryption of various file sized message in simulated
parallel environment using RSA public-key crypto system based on the properties
of magic squares is shown in Figure #-18. The simulation scenario configured in
our implementation consisting of 2, 4, and 8 processors.
From Figure #-18 we observe that as the file size is increased in double,
encryption and decryption time is also increased in double for single processor.
Moreover, the time taken for encryption and decryption is almost same. Parallel
encryption and decryption have more effect if the file size is increased.
File
Size (MB)
No.of Processors
1 2 4 8
E ms
D ms
T ms
E ms
D ms
T ms
E ms
D ms
T ms
E ms
D ms
T ms
1 362 405 767 560 607 1167 502 515 1017 450 447 897
2 700 707 1407 737 756 1493 590 599 1189 514 530 1044
3 1332 1370 2702 1073 1097 2170 753 672 1425 610 605 1215
4 2601 2618 5219 1700 1741 3441 1084 1100 2184 765 776 1541
E.Encryption time, D.Decryption time, and ms-milliseconds
Figure # -19 . Encryption and decryption time using RSA on a Pentium Processor
Based on Properties of Magic Squares
14 Chapter
CONCLUSION
An alternative approach to existing ASCII based cryptosystem a number based
on magic squares generated by two different schemes is thought of and
implemented. It is noted that that the numerals generated using different views of
magic square for encryption may be obtained by the eavesdropper(but it is very
difficult) because of some kind of relat ionship exists among the numerals. But, in
the case of magic squares generated using the properties, it is very difficult to
obtain the numerals by him because of the numbers do not have any kind of
relationship and hence it is very difficult to obtain such numerals for encryption.
Thus, the second approach is better than the first one. This methodology will add -
on one more layer of security, it adds numerals for the text even before feed ing into
public-key algorithm for encryption. Th is add-on security is built using magic
square position equivalent to the character to be encrypted.
Further efficiency of cryptographic operation depends on performing them in
parallel. Simulation using different number of processors for encryption /decryption
has shown that the time taken for decryption is approximately 1.2 t imes larger than
the corresponding time for encryption.
References
1. Antti Hamalainenn, Matti Tommiska, and Jorma Skytta, 6.78 Gigabits per Second Implementation of
the IDEA Cryptographic Algorithm LNCS 2438, Springer-Verlag, 2002, p. 760-769. 2. Thomas Wollinger, Jorge Guajardo, and Chirst of Paar,Cryptography in Embedded Systems: An
overview. In Proc. of the Embedded World 2003 Exhibition and Conference, Feb. 18-20, 2003, p. 735-744.
3. Josef Piepryk, and David Pointcheval, Parallel Authentication and Public-Key Encryption, The Eigth Australasian Conference on Information Security and Privacy, Springer-Verlag, Jul. 2003, p.
383-401. 4. A. J. Menezes, P.C. Van Oorschot, and S. Vanstone, Handbook of Applied Cryptography, (CRC
Press, Boca Ration, Florida, USA, 1997).
5. http://en.wikipedia.org/wiki/Magic_ squares , p. 1-3. 6. Adam Rogers, and Peter Loly, The Inertial Properties of Magic Squares and Cube, Nov. 2004, p. 1-3. 7. Clifford A. Pickover, The Zen of Magic Squares, Circles and Stars (Universities Press, Hyderabad,
India, 2002). 8. Gopinath Ganapathy, and K. Mani, Add-On Security Model for Public-KeyCryptosystem Based on
Magic Square Implementation, WCECS, (October 20-22, 2009, San Francisco, USA), p. 317-321. 9. Gary A Foster, St.Joseph‘s Healthcare Hamilton, Hamilton, et al, (Global Forum 2009) SAS ® Magic
Squares. 10. John P.Robertson ,Theory of 4 × 4 Magic Squares (January 17, 2009). 11. Y.Zhang, H. Franke, J. E. Moreira and A. Sivasubramanian, An Integrated Approach to Parallel
Scheduling using Gang-Scheduling, Backfilling andMigration, JSSPP, UK, Springer-Verlag, 2006, p. 133-158.