Magic Square
and
Cryptography
Tomoko
Adachi,
YoheiSugita
Department
of InformationSciences,
TohoUniversity
2‐2‐1Miyama, Funabashi, Chiba,
274‐8510,
Japan
E‐mail:
adachi@is.sci.toho‐u.ac.jp
1. Introduction
A
magic
squareof ordern isanarrangement
of then^{2} integers
0,1,
\cdots,n^{2}-1
into an n\times n square with the
property
that the sums of each row, eachcolumn,
and eachof the main
diagonals
arethesame.Magic
squares areknown in ancienttimes in China and India.
Many people
have been interested inmagic
squares for hundreds years.In this paper, we describe relation of
magic
squares and latin squares. More‐over, we described
cryptosystem
basedonmagic
squares.2.
Magic Square
and LatinSquare
A latin square oforder n is an n\times n array in which n distinct
symbols
arearranged
sothat eachsymbol
occursonce ineach row and column.Let
L_{1}
andL_{2}
be latinsquares of thesame ordern(\geq 2)
. WesaythatL_{1}
andL_{2}
areorthogonal if,
whensuperimposed,
each of thepossible n^{2}
orderedpairs
occursexactly
once. We say that a set\{L_{1}, L_{2}, \cdots, L_{t}\}
oft(\geq 2)
latin squaresof order n is
orthogonal
if any two distinct squares areorthogonal.
Such a setof
orthogonal
squares is said to be a set ofrnutually orthogonal
latin squares(MOLS).
For
q\geq 5
an oddprime
power, aset ofq-3
MOLS of order q eachof which has distinct elements on the two maindiagonals.
Such latin squares aresaid tobe
diagonal.
Theorem 2.1
(Ỉ21)
If
n is aninteger
for
which thereis apair
of orthogonal diag‐
onal latinsquares
of
ordern, then amagic
squareof
ordern can be constructed.Example
2.2 Let consider thefollowing orthogonal diagonal
latin square of order 5.数理解析研究所講究録
4 2 1 0 3 0 3 4 2 1
L_{1} = 2 1 0 3 4
3 4 2 1 0 1 0 3 4 2 4 0 2 1 3 2 1 3 4 0L_{2}
= 3 4 0 2 1 0 2 1 3 4 1 3 4 0 2If
L_{1}
issuperimposed
onL_{2}
,weobtain thefollowing
arrayL_{1}L_{2}
of orderedpairs.
Ifwe consider an ordered
pair
in each cellofL_{1}L_{2}
as apentanary
number,
and wechange
apentanary
number in each cell ofL_{1}L_{2}
into adenary
number,
weobtain the
magic
square M of order 5. 44 20 12 01 33 02 31 43 24 10L_{1}L_{2}
= 23 14 00 32 41 30 42 21 13 04 11 03 34 40 22 24 10 7 1 18 2 16 23 14 5 M = 13 9 0 17 21 15 22 11 8 4 6 3 19 20 123.
Cryptosystem
Based onMagic Square
In this
section,
we describedcryptosystem
based onmagic
squares([1]).
At
first,
we prepare a 4digits
seednumber,
astarting
number of amagic
square, and a
magic
square sum, Thealgorithm
of[1]
starts withbuilding
4\times 4magic
square,by using
astarting
number andamagic
squaresum.Incrementally,
8\times 8 and 16\times 16
magic
squares arebuiltusing
4\times 4magic
squares asbuilding
blocks. Ifwe have a message with t
letters,
we build t16\times 16magic
squares.Secondly,
weinvestigate
theASCIIvalue of each letter inamessage.Suppose
that we have a message ABA The ASCII values offor \mathrm{A} and B are 65and
66, respectively.
Toencrypt
(\mathrm{A},
the numerals whichoccur at65‐thposition
infirst and third 16\times 16magic
squares aretaken. Toencrypt
\mathrm{B},
the numeralwhich occurs at 66‐th
position
in second 16\times 16magic
square is taken. When weencrypt
a message, we use apublic‐key
cryptosystem
RSA.Then,
the firstand third letters Aare
encrypted
differentcipher
texts, since we use different16\times 16
magic
squares.References
[1]
G.Ganapathy,
and K.Mani(2009);
Add‐OnSecurity
Model forPublic‐Key
Crtptosystem
Based onMagic Square Implementation, Proceedings of
theWorld