Nhập môn An toàn Thông tin
Nhập môn An toàn Thông tin
1 / 26
Tài liệu
https://www.crypto-textbook.com
2 / 26
Nội dung
1 Giới thiệu
Before we turn to stream ciphers used in the real world, it should be stressed tha
ractical stream ciphers are not unconditionally secure. In fact, all known practica
4 / 26
Thanh ghi dịch phản hồi tuyến tính
Linear Feedback Shift Register (LFSR)
2 2 Stream Ciphe
Fig. 2.6 Linear feedback shift register of degree 3 with initial values s2 , s1 , s0
Hình: LFSR bậc m = 3 với ba Flip-flops F F2 , F F1 vF F0
clk F F2 F F1 F F0 = si
0 1 0 0
1 0 1 0
2 1 0 1
3 1 1 0
4 1 1 1
si+3 = si+1 ⊕ si
5 0 1 1
6 0 0 1
7 1 0 0
8 0 1 0
6 / 26
Nội dung
1 Giới thiệu
Fig. 2.6 Linear feedback shift register of degree 3 with initial values s2 , s1 , s0
Công thức truy hồi:
Table 2.2 Sequence of states of the LFSR
si+3 = 0 · si+2 + 1 · si+1 + 1 · si mod 2, i = 0, 1, 2, . . .
clk FF2 FF1 FF0 = si
0 1 0 0
1 0 1 0
2 1 0 1
3 1 1 0 8 / 26
path. If we multiply the output of flip-flop i by its coefficient pi , the result is eithe
he output value if pi = 1, which corresponds to a closed switch, or the value zero i
pi = 0, which corresponds to an open switch. TheLFSR tổng
values of quát coefficient
the feedback
are crucial for the output sequence produced by the LFSR.
Fig. 2.7 General LFSR with feedback coefficients pi and initial values sm−1 , . . . , s0
Hình: LFSR với hệ số phản hồi pi và giá trị ban đầu sm−1 , . . . , s0
Let’s assume the LFSR is initially loaded with the values s0 , . . . , sm−1 . The nex
output bit of the LFSR sm , which is also the input to the leftmost flip-flop, can b
computed by the XOR-sum of the products of flip-flop outputs and correspondin
9 / 26
! If pi = 0 (open switch), the corresponding flip-flop output is not used for th
feedback.
Công thức truy hồi
With this notation, we obtain an elegant mathematical description for the feedbac
path. If we multiply the output of flip-flop i by its coefficient pi , the result is eithe
he output value if pi = 1, which corresponds
m−1
X to a closed switch, or the value zero i
pi = 0, which corresponds tosi+m = switch.
an open p j · si+The values
j mod 2 of the feedback coefficient
are crucial for the output sequence produced by the LFSR.
j=0
Fig. 2.7 General LFSR with feedback coefficients pi and initial values sm−1 , . . . , s0
10 / 26
Bài tập
(p3 = 0, p2 = 0, p1 = 1, p0 = 1).
• Bắt đầu từ
s3 = 0, s2 = 1, s1 = 0, s0 = 0
hãy tính 15 bit tiếp theo của dãy output.
11 / 26
Bài tập
(p3 = 1, p2 = 1, p1 = 1, p0 = 1).
• Bắt đầu từ
s3 = 0, s2 = 1, s1 = 0, s0 = 1
hãy tính 15 bit tiếp theo của dãy output.
12 / 26
Độ dài lớn nhất của dãy
• Xét dãy tạo bởi LFSR với công thức truy hồi:
m−1
X
si+m = p j · si+ j mod 2; si , p j ∈ {0, 1}; i = 0, 1, 2, . . .
j=0
• Phụ thuộc vào m, dãy này lặp lại theo chu kỳ với độ dài khác
nhau.
Định lý
Độ dài (chu kỳ) lớn nhất của dãy sinh bởi LFSR là 2m − 1.
13 / 26
Ví dụ
Xét LFSR với bậc m = 4 và hệ số phản hồi
(p3 = 0, p2 = 0, p1 = 1, p0 = 1).
Ví dụ
Xét LFSR với bậc m = 4 và hệ số phản hồi
(p3 = 1, p2 = 1, p1 = 1, p0 = 1).
14 / 26
LSFR và đa thức
Ví dụ
LFSR với bậc m = 4 và hệ số phản hồi
(p3 = 0, p2 = 0, p1 = 1, p0 = 1)
P(x) = x 4 + x + 1.
15 / 26
Ví dụ
LFSR với bậc m = 4 và hệ số phản hồi
(p3 = 1, p2 = 1, p1 = 1, p0 = 1)
P(x) = x 4 + x 3 + x 2 + x + 1.
16 / 26
Đa thức nguyên thuỷ và LSFR
• Chỉ có LFSR xác định bởi đa thức nguyên thuỷ mới có dãy
output với chu kỳ cực đại!
• Đa thức nguyên thuỷ là một trường hợp riêng của đa thức bất
khả quy (giống số nguyên tố).
• Ví dụ: Đa thức
(0, 2, 5) → 1 + x 2 + x 5
là đa thức nguyên thuỷ.
17 / 26
Một số đa thức nguyên thuỷ
(0,1,2) (0,1,3,4,24) (0,1,46) (0,1,5,7,68) (0,2,3,5,90) (0,3,4,5,112)
(0,1,3) (0,3,25) (0,5,47) (0,2,5,6,69) (0,1,5,8,91) (0,2,3,5,113)
(0,1,4) (0,1,3,4,26) (0,2,3,5,48) (0,1,3,5,70) (0,2,5,6,92) (0,2,3,5,114)
(0,2,5) (0,1,2,5,27) (0,4,5,6,49) (0,1,3,5,71) (0,2,93) (0,5,7,8,115)
(0,1,6) (0,1,28) (0,2,3,4,50) (0,3,9,10,72) (0,1,5,6,94) (0,1,2,4,116)
(0,1,7) (0,2,29) (0,1,3,6,51) (0,2,3,4,73) (0,11,95) (0,1,2,5,117)
(0,1,3,4,8) (0,1,30) (0,3,52) (0,1,2,6,74) (0,6,9,10,96) (0,2,5,6,118)
(0,1,9) (0,3,31) (0,1,2,6,53) (0,1,3,6,75) (0,6,97) (0,8,119)
(0,3,10) (0,2,3,7,32) (0,3,6,8,54) (0,2,4,5,76) (0,3,4,7,98) (0,1,3,4,120)
(0,2,11) (0,1,3,6,33) (0,1,2,6,55) (0,2,5,6,77) (0,1,3,6,99) (0,1,5,8,121)
(0,3,12) (0,1,3,4,34) (0,2,4,7,56) (0,1,2,7,78) (0,2,5,6,100) (0,1,2,6,122)
(0,1,3,4,13) (0,2,35) (0,4,57) (0,2,3,4,79) (0,1,6,7,101) (0,2,123)
(0,5,14) (0,2,4,5,36) (0,1,5,6,58) (0,2,4,9,80) (0,3,5,6,102) (0,37,124)
(0,1,15) (0,1,4,6,37) (0,2,4,7,59) (0,4,81) (0,9,103) (0,5,6,7,125)
(0,1,3,5,16) (0,1,5,6,38) (0,1,60) (0,4,6,9,82) (0,1,3,4,104) (0,2,4,7,126)
(0,3,17) (0,4,39) (0,1,2,5,61) (0,2,4,7,83) (0,4,105) (0,1,127)
(0,3,18) (0,3,4,5,40) (0,3,5,6,62) (0,5,84) (0,1,5,6,106) (0,1,2,7,128)
(0,1,2,5,19) (0,3,41) (0,1,63) (0,1,2,8,85) (0,4,7,9,107)
(0,3,20) (0,1,2,5,42) (0,1,3,4,64) (0,2,5,6,86) (0,1,4,6,108)
(0,2,21) (0,3,4,6,43) (0,1,3,4,65) (0,1,5,7,87) (0,2,4,5,109)
(0,1,22) (0,5,44) (0,3,66) (0,8,9,11,88) (0,1,4,6,110)
(0,5,23) (0,1,3,4,45) (0,1,2,5,67)
18 / 26
Nội dung
1 Giới thiệu
Oscar có:
• Mọi bit bản mã yi
• Bậc m
• Các bit bản rõ (x 0 , x 1 , . . . , x 2m−1 )
20 / 26
Bước 1
Tính toán
yi = x i + si mod 2
si = yi + x i mod 2
với i = 0, 1, . . . , 2m − 1
21 / 26
Bước 2
s2m , s2m+1 , . . .
p0 , p1 , . . . , pm−1 ?
Nhắc lại:
m−1
X
si+m = p j · si+ j mod 2
j=0
22 / 26
Bước 2: Tính pi
i = 0, sm = pm sm−1 + · · · + p1 s1 + p0 s0 mod 2
i = 1, sm+1 = pm sm + · · · + p1 s2 + p0 s1 mod 2
..
.
i = m − 1, s2m−1 = pm−1 s2m−2 + · · · + p1 sm + p0 sm−1 mod 2
23 / 26
Hệ quả
Nếu kẻ tấn công có (ít nhất) 2m giá trị output của LFSR, anh ta có
thể lấy được toàn bộ thông tin về cấu hình
p0 , p1 , . . . , pm−1 .
của LFSR.
24 / 26
Bước 3
25 / 26
Cảm ơn!
26 / 26