You are on page 1of 46

TRƯỜNG ĐẠI HỌC BÁCH KHOA HÀ NỘI

VIỆN ĐIỆN TỬ - VIỄN THÔNG

Toán học Mật mã


Phần II: Cấu trúc đại số

Giảng viên: PGS. TS. Hà Duyên Trung


Cơ sở toán học cho hệ mật mã khóa đối
xứng hiện đại

Nhóm Vành Trường

2
Cơ sở toán học cho hệ mật mã khóa đối
xứng hiện đại
1. Nhóm
• A group (G) is a set of elements with a binary operation (•) that
satisfies four properties:
• Closure Tính đóng
• Associativity
• Existence of identity Tính kết hợp
• Existence of inverse
Tồn tại giá trị đơn vị
Tồn tại giá trị nghịch đảo

3
Cơ sở toán học cho hệ mật mã khóa đối
xứng hiện đại
1. Nhóm
• A commutative group satisfies an extra property,
commutatively or abelian group
• Closure Tính đóng
• Commutative
• Associative Tính giao hoán
• Existence of identity
Tính kết hợp
• Existence of inverse
Tồn tại giá trị đơn vị

Tồn tại giá trị nghịch đảo

4
Cơ sở toán học cho hệ mật mã khóa đối
xứng hiện đại
1. Nhóm
• A commutative group satisfies an extra property,
commutatively or abelian group
• Closure: 𝑎, 𝑏 ∈ 𝐺 𝑡ℎì 𝑐 = a (•) b ∈ 𝐺
• Commutatively: 𝑎 ∙ 𝑏 = 𝑏 ∙ 𝑎
• Associativity: c(•)(𝑎 ∙ 𝑏) = c(•)𝑎 ∙ 𝑏
• Existence of identity: 𝑎 ∙ 𝑒 = 𝑒 ∙ 𝑎 = 𝑎
• Existence of inverse: 𝑎 ∙ 𝑎′ = 𝑎′ ∙ 𝑎 = 𝑒

5
Cơ sở toán học cho hệ mật mã khóa đối
xứng hiện đại
1. Nhóm
Nhóm G = < Zn , +> là nhóm gì?
Tại sao nhóm G = <Zn*, ×>, lại là một nhóm Abelian?
Cho nhóm G = < {a, b, c, d}, •> Với phép toán được định nghĩa

Đây là nhóm loại nào? Tai sao?

6
Cơ sở toán học cho hệ mật mã khóa đối
xứng hiện đại
1. Nhóm
• A very interesting group is the permutation group. The set is the
set of all permutations, and the operation is composition:
applying one permutation after another.

7
Cơ sở toán học cho hệ mật mã khóa đối
xứng hiện đại
1. Nhóm
• A very interesting group is the permutation group. The set is the
set of all permutations, and the operation is composition:
applying one permutation after another.

8
Cơ sở toán học cho hệ mật mã khóa đối
xứng hiện đại
1. Nhóm
• Finite Group
Nhóm hữu hạn là nhóm có số hữu hạn các phần tử
• Order of a Group
Cấp (bậc) của nhóm là số phần tử của nhóm đó
• Subgroup

Nhóm con của một nhóm G là nhóm bao gồm các phần tử
thuộc G đồng thời thỏa mãn phép toán đóng trong G

9
Cơ sở toán học cho hệ mật mã khóa đối
xứng hiện đại
1. Nhóm
• Tính chất của subgroup

Is the group H = <Z10, +> a subgroup of the group G = <Z12,


+>?
The answer is no. Although H is a subset of G, the operations defined
for these two groups are different. The operation in H is addition
modulo 10; the operation in G is addition modulo 12.

10
Cơ sở toán học cho hệ mật mã khóa đối
xứng hiện đại
1. Nhóm
Cyclic Subgroups
• Nhóm con Cyclic là nhóm được tạo ra bởi cấp số của 1 phần
tử nhóm gốc
• Cấp số của phần tử là số lần thực hiện lặp lại phép toán đối
với phần tử đó

11
Cơ sở toán học cho hệ mật mã khóa đối
xứng hiện đại
1. Nhóm
Cyclic Subgroups
Ví dụ: Hãy cho biết các nhóm con Cyclic của nhóm 𝐺 = < 𝑍6,+>
H1 = <{0}, +> H2 = <{0, 2, 4},+>

H3 = <{0, 3},+>

12
Cơ sở toán học cho hệ mật mã khóa đối
xứng hiện đại
1. Nhóm
Cyclic Subgroups
Ví dụ: Hãy cho biết các nhóm con Cyclic của nhóm 𝐺 = < 𝑍6,+>
H4 = G

13
Cơ sở toán học cho hệ mật mã khóa đối
xứng hiện đại
1. Nhóm
Cyclic Group
• Nhóm G là nhóm Cyclic khi G chính là nhóm con Cyclic

H4 = G

14
Cơ sở toán học cho hệ mật mã khóa đối
xứng hiện đại
1. Nhóm
Lagrange’s Theorem
Assume that G is a group, and H is a subgroup of G. If the order
of G and H are |G| and |H|, respectively, then, based on this
theorem, |H| divides |G|.
Order of an Element
The order of an element, ord(a), is the smallest integer that
𝑎𝑛 = 𝑒.

In the group G = <Z6, +>, the orders of the elements are: ord(0) = 1, ord(1)
= 6, ord(2) = 3, ord(3) = 2, ord(4) = 3, ord(5) = 6.

15
Cơ sở toán học cho hệ mật mã khóa đối
xứng hiện đại
2. Vành
A ring, R = <{…}, •, ∎ >, is an algebraic structure with two operations.

The second operation must be distributed over the first


𝑎∎ 𝑏 ∘ 𝑐 = (𝑎∎𝑏) ∘ (𝑎∎𝑐)
(𝑎 ∘ 𝑏)∎𝑐 = (𝑎∎𝑐) ∘ (𝑏∎𝑐)

16
Cơ sở toán học cho hệ mật mã khóa đối
xứng hiện đại
2. Vành

The second operation must be distributed over the first


𝑎∎ 𝑏 ∘ 𝑐 = (𝑎∎𝑏) ∘ (𝑎∎𝑐)
(𝑎 ∘ 𝑏)∎𝑐 = (𝑎∎𝑐) ∘ (𝑏∎𝑐)

The set Z with two operations, addition and multiplication, is a


commutative ring (vòng giao hoán). We show it by R = <Z, +,
×>. Addition satisfies all of the five properties; multiplication
satisfies only three properties.

17
Cơ sở toán học cho hệ mật mã khóa đối
xứng hiện đại
3. Trường
A field, denoted by F = <{…}, •, ∎ > is a commutative ring in which the second
operation satisfies all five properties defined for the first operation except that the
identity of the first operation has no inverse.
Một trường, được ký hiệu là F = <{…}, •, ∎> là một vành giao hoán trong đó
phép toán thứ hai thỏa mãn tất cả năm thuộc tính được xác định cho phép toán
đầu tiên ngoại trừ việc nhận dạng của phép toán đầu tiên không có nghịch đảo.

18
Cơ sở toán học cho hệ mật mã khóa đối
xứng hiện đại
3. Trường
• A finite field, a field with a finite number of elements, are very
important structures in cryptography.
• Một trường hữu hạn, một trường có số phần tử hữu hạn, là những
cấu trúc rất quan trọng trong mật mã.
• Galois showed that for a field to be finite, the number of elements
should be 𝑝𝑛 , where p is a prime and n is a positive integer.
• Galois chỉ ra rằng để một trường là hữu hạn, số phần tử phải là 𝑝 ^
𝑛, trong đó p là số nguyên tố và n là số nguyên dương.
p là số nguyên tố, n là số nguyên dương

A Galois field, GF(pn), is a finite field


with pn elements.
19
Cơ sở toán học cho hệ mật mã khóa đối
xứng hiện đại
3. Trường

A Galois field, GF(pn), is a finite field


with pn elements.
When n = 1, we have GF(p) field. This field can be the set Zp, {0, 1,
…, p − 1}, with two arithmetic operations (2 phép toán số học).
A very common field in this category is GF(2) with the set {0, 1} and
two operations, addition and multiplication (phép cộng, nhân).
a 0 1 a 0 1
-a 0 1 a-1 N/A 1

20
Cơ sở toán học cho hệ mật mã khóa đối
xứng hiện đại
3. Trường GF(2n)

In cryptography, we often need to use four operations


(addition, subtraction, multiplication, and division). In
other words, we need to use fields. We can work in
GF(2n) and uses a set of 2n elements. The elements in
this set are n-bit words.
3.1 Polynomials: Đa thức
3.2 Using A Generator: Sử dụng phần tử sinh
3.3 Summary

21
Cơ sở toán học cho hệ mật mã khóa đối
xứng hiện đại
3. Trường GF(2n)
Let us define a GF(22) field in which the set has four 2-bit words:
{00, 01, 10, 11}. We can redefine addition and multiplication for
this field in such a way that all properties of these operations are
satisfied.

An example of GF(22) field 22


Cơ sở toán học cho hệ mật mã khóa đối
xứng hiện đại
3. Trường GF(2n) Polynomials

A polynomial of degree n − 1 is an expression


of the form

where xi is called the ith term and ai is called coefficient of


the ith term.

23
Cơ sở toán học cho hệ mật mã khóa đối
xứng hiện đại
3. Trường GF(2n) Polynomials
How we can represent the 8-bit word (10011001)
using a polynomials?

24
Cơ sở toán học cho hệ mật mã khóa đối
xứng hiện đại
3. Trường GF(2n) Polynomials

To find the 8-bit word related to the polynomial x5 + x2 + x, we


first supply the omitted terms. Since n = 8, it means the
polynomial is of degree 7.
The expanded polynomial is

This is related to the 8-bit word 00100110.

25
Cơ sở toán học cho hệ mật mã khóa đối
xứng hiện đại
3. Trường GF(2n) Polynomials

Lưu ý:

Polynomials representing n-bit words


use two fields: GF(2) and GF(2n)

26
Cơ sở toán học cho hệ mật mã khóa đối
xứng hiện đại
3. Trường GF(2n) Modulus
For the sets of polynomials in GF(2n), a group of polynomials of degree n is defined
as the modulus. Such polynomials are referred to as irreducible polynomials.
Đối với các tập đa thức trong GF (2n), một nhóm đa thức bậc n được định nghĩa là
mô-đun. Các đa thức như vậy được gọi là đa thức bất khả quy (tối giản).

(Đa thức tối giản)

27
Cơ sở toán học cho hệ mật mã khóa đối
xứng hiện đại
3. Trường GF(2n) Modulus

Lưu ý:

Addition and subtraction operations on


polynomials are the same operation.

Các phép toán cộng và trừ trên đa


thức là một phép toán giống nhau.

28
Cơ sở toán học cho hệ mật mã khóa đối
xứng hiện đại
3. Trường GF(2n) Modulus

Let us do (x5 + x2 + x) Å (x3 + x2 + 1) in GF(28). We use the symbol


Å to show that we mean polynomial addition.

The following shows the procedure:

29
Cơ sở toán học cho hệ mật mã khóa đối
xứng hiện đại
3. Trường GF(2n) Modulus

There is also another short cut. Because the addition in GF(2)


means the exclusive-or (XOR) operation. So, we can exclusive-or
the two words, bits by bits, to get the result. In the previous
example, x5 + x2 + x is 00100110 and x3 + x2 + 1 is 00001101. The
result is 00101011 or in polynomial notation x5 + x3 + x + 1.

30
Cơ sở toán học cho hệ mật mã khóa đối
xứng hiện đại
3. Trường GF(2n) Multiplication

1. The coefficient multiplication is done in GF(2).

2. The multiplying xi by xj results in xi+j

3. The multiplication may create terms with degree more


than n − 1, which means the result needs to be reduced
using a modulus polynomial.
Phép nhân có thể tạo ra các số hạng có bậc lớn hơn n - 1, có nghĩa là kết
quả cần được rút gọn bằng cách sử dụng một đa thức môđun.

31
Cơ sở toán học cho hệ mật mã khóa đối
xứng hiện đại
3. Trường GF(2n) Multiplication

Find the result of (x5 + x2 + x) ⊗ (x7 + x4 + x3 + x2 + x) in GF(28)


with irreducible polynomial (x8 + x4 + x3 + x + 1). Note that we use
the symbol ⊗ to show the multiplication of two polynomials.

Solution

32
Cơ sở toán học cho hệ mật mã khóa đối
xứng hiện đại
3. Trường GF(2n) Multiplication
To find the final result, divide the polynomial of degree 12 by the
polynomial of degree 8 (the modulus) and keep only the
remainder.

Polynomial division with


coefficients in GF(2)

33
Cơ sở toán học cho hệ mật mã khóa đối
xứng hiện đại
3. Trường GF(2n) Multiplication
In GF (24), find the inverse of (x2 + 1) modulo (x4 + x + 1).

Solution
The answer is (x3 + x + 1)

34
Cơ sở toán học cho hệ mật mã khóa đối
xứng hiện đại
3. Trường GF(2n) Multiplication
In GF(28), find the inverse of (x5) modulo (x8 + x4 + x3 + x + 1) ?

Solution

The answer is (x5 + x4 + x3 + x)

35
Cơ sở toán học cho hệ mật mã khóa đối
xứng hiện đại
3. Trường GF(2n) Multiplication

Find the result of multiplying P1 = (x5 + x2 + x) by P2 = (x7 + x4 + x3


+ x2 + x) in GF(28) with irreducible polynomial (x8 + x4 + x3 + x +
1) using Euclidean algorithm.

36
Cơ sở toán học cho hệ mật mã khóa đối
xứng hiện đại
3. Trường GF(2n) Multiplication
Find the result of multiplying P1 = (x5 + x2 + x) by P2 = (x7 + x4 + x3
+ x2 + x) in GF(28) with irreducible polynomial (x8 + x4 + x3 + x +
1) using Euclidean algorithm.

37
Cơ sở toán học cho hệ mật mã khóa đối
xứng hiện đại
3. Trường GF(2n) Multiplication

We first find the partial result of multiplying x0, x1, x2, x3, x4, and x5 by P2. Note
that although only three terms are needed, the product of xm ⊗ P2 for m from
0 to 5 because each calculation depends on the previous result.

38
Cơ sở toán học cho hệ mật mã khóa đối
xứng hiện đại
3. Trường GF(2n) Multiplication

Find the result of multiplying P1 = (x5 + x2 + x) by P2 = (x7 + x4 + x3


+ x2 + x) in GF(28) with irreducible polynomial (x8 + x4 + x3 + x +
1) using Euclidean algorithm.
Repeat Example => using bit patterns of size 8.
We have
P1 = 000100110 <=> (x5 + x2 + x)
P2 = 010011110 <=> (x7 + x4 + x3 + x2 + x)
Modulus = 100011010 <=> (x8 + x4 + x3 + x + 1)

39
Cơ sở toán học cho hệ mật mã khóa đối
xứng hiện đại
3. Trường GF(2n) Multiplication
Repeat Example => using bit patterns of size 8.
We have P1 = 000100110, P2 = 10011110 P1 = (x5 + x2 + x)

40
Cơ sở toán học cho hệ mật mã khóa đối
xứng hiện đại
3. Trường GF(2n) Generator: phần tử sinh

Sometimes it is easier to define the elements of the


GF(2n) field using a generator.

41
Cơ sở toán học cho hệ mật mã khóa đối
xứng hiện đại
3. Trường GF(2n) Generator phần tử sinh
Generate the elements of the field GF(24) using the irreducible
polynomial ƒ(x) = x4 + x + 1.

Solution
The elements 0, g0, g1, g2, and g3 can be easily generated, because
they are the 4-bit representations of 0, 1, x2, and x3. Elements g4
through g14, which represent x4 though x14 need to be divided by
the irreducible polynomial. To avoid the polynomial division, the
relation ƒ(g) = g4 + g + 1 = 0 can be used.

42
Cơ sở toán học cho hệ mật mã khóa đối
xứng hiện đại
3. Trường GF(2n) Generator phần tử sinh

43
Cơ sở toán học cho hệ mật mã khóa đối
xứng hiện đại
3. Trường GF(2n) Generator

The following show the results of addition and subtraction


operations:

44
Cơ sở toán học cho hệ mật mã khóa đối
xứng hiện đại
3. Trường GF(2n) Generator

The following show the result of multiplication and division


operations:.

Sau đây là kết quả của các phép tính nhân và chia:

45
Cơ sở toán học cho hệ mật mã khóa đối
xứng hiện đại
3. Trường GF(2n) Summary

The finite field GF(2n) can be used to define four


operations of addition, subtraction, multiplication and
division over n-bit words. The only restriction is that
division by zero is not defined.

Trường hữu hạn GF (2n) có thể được sử dụng để xác định bốn
phép toán cộng, trừ, nhân và chia trên các từ n-bit. Hạn chế duy
nhất là phép chia cho 0 không được xác định.

46

You might also like