NXN Application To Cryptography
NXN Application To Cryptography
n n determinant and
an application to cryptography
Feb, 2011.
Yesterday A formula
for matrix inverse using cofactors
cofactors
ENGG2013
Outline
nxn determinant
Caesar Cipher
Modulo arithmetic
Hill Cipher
kshum
ENGG2013
DETERMINANT IN GENERAL
kshum
ENGG2013
A pattern
ENGG2013
Transposition
A transposition is an exchange of two objects
in a list of objects.
Examples:
ABCD
21453
ACBD
12453
Transposition is another
mathematical term, and is
not the same as matrix tranpose.
kshum
ENGG2013
Another pattern
ENGG2013
The sign
Let p(1), p(2), , p(n) be an order of 1,2,,n.
For example p(1)=3, p(2) = 2, p(3)=1 is an ordering
of 1, 2, 3.
ENGG2013
Definition of nn determinant
1
ENGG2013
Properties of determinant
Determinant of nn identity matrix equals 1.
Exchange two rows (or columns) multiply
determinant by 1.
Multiply a row (or a column) by a constant k
multiply the determinant by k.
Add a constant multiple of a row (column) to
another row (column) no change
Additive property as in the 33 and 22 case.
kshum
ENGG2013
10
adjoint of A
nxn identity
ENGG2013
11
CAESAR CIPHER
kshum
ENGG2013
12
ENGG2013
13
Caesar cipher
http://en.wikipedia.org/wiki/Caesar_cipher
ATTACK
ENGG2013
14
Plain text
Plain text
Decryption
function
Ciphertext
Ciphertext
key
kshum
ENGG2013
15
Mathematical description
Caesar cipher is not secure
enough, because the number
of keys is too small.
Key =3
ATTACK
ATTACK
DWWDFN
DWWDFN
Key = 3
kshum
ENGG2013
16
MODULO ARITHMETIC
kshum
ENGG2013
17
Mod 12
Clock arithmetic
6+8= 2 mod 12
12
1
11
10
5+12 = 5 mod 12
2
4
8
7
kshum
6
ENGG2013
5
18
Mod 7
Week arithmetic
1+9 = 3 mod 7
2+3 = 5 mod 7
0
Sun
Mon
Tue
Wed
Thr
5
Fri
6
Sat
1
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
6
kshum
ENGG2013
19
Mod 60
http://www.hko.gov.hk/gts/time/stemsandbranchesc.htm
arithmetic
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 33 34 35 36
Year of rabbit
37 38 39 40 41 42 43 44 45 46 47 48
49 50 51 52 53 54 55 56 57 58 59 60
kshum
ENGG2013
20
ENGG2013
21
More examples
10 mod 7 = 3
4+5 mod 7 = 2
6+7 mod 7 = 6
27 mod 7 = 0
kshum
ENGG2013
22
Mod 26
A
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
ENGG2013
23
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
3+19 = ? mod 26
13+20 = ? mod 26
34 = ? Mod 26
134 = ? Mod 26
kshum
ENGG2013
24
Peculiar phenomena
in modulo arithmetic
Non-zero times non-zero may be zero
49 = 0 mod 12
22 = 0 mod 4
kshum
ENGG2013
25
ENGG2013
Fraction
26
HILL CIPHER
kshum
ENGG2013
27
Hill cipher
http://en.wikipedia.org/wiki/Hill_cipher
ENGG2013
28
Note
The decryption must be the inverse function of
the encryption function.
It is required that K-1 K = In mod 26.
ENGG2013
29
Example
Plain text: LOVE, Secret Key:
LO
VE
2, 3, 16, 5 are transformed to cipher text
CDQF
A
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
kshum
ENGG2013
30
How to decode?
Given CDQF, and the encryption matrix
How do we decrypt?
We need to compute the inverse of
kshum
ENGG2013
31
Determinant
The determinant of
equals 20(7)-3(15),
which is 17 mod 26.
Find the multiplicative inverse of 17 mod 26,
i.e., find integer x such that 17x = 1 mod 26.
Just try all 26 possibilities for x:
171 = 17 mod 26
172= 8 mod 26
173 = 25 mod 26
174 = 16 mod 26
175 = 7 mod 26
176 = 24 mod 26
177 = 15 mod 26
kshum
178 = 6 mod 26
179= 23 mod 26
1710 = 14 mod 26
1711 = 5 mod 26
1712 = 22 mod 26
1713 = 13 mod 26
1714 = 4 mod 26
ENGG2013
1715 = 21 mod 26
1716= 12 mod 26
1717 = 3 mod 26
1718 = 20 mod 26
1719 = 11 mod 26
1720 = 2 mod 26
1721 = 19 mod 26
1722 = 10 mod 26
1723= 1 mod 26
1724 = 18 mod 26
1725 = 9 mod 26
170 = 0 mod 26
32
we get
kshum
ENGG2013
33
Decryption
Given the ciphertext CDQF, we decrypt by
multiplying by
ENGG2013
34