Uploaded by khaydarovna02

+15.Oqimli shifrlash (A5,1)

advertisement
A5/1 malumotlarni shifrlash algoritmi
Bu usulda ishlashimiz uchun biz alifbo harflarini va bazi belgilarni 2lik sanoq
tizimiga otkizib jadval tuzib olamiz.
A=00000 I=01000 Q=10000 Y=11000
B=00001 J=01001 R=10001 Z=11001
C=00010 K=01010 S=10010 _=11010
D=00011 L=01011 T=10011 ,=11011
E=00100 M=01100 U=10100 !=11100
F=00101 N=01101 W=10101 ‘=11101
G=00110 O=01110 V=10110 @=11110
H=00111 P=01111 X=10111 .=11111
Shifrlash
Bu usulda shifrlash quyidagi tartibda bo`ladi. Ochiq matin va daslabki kalit soz beriladi.
Dastlabki kalit soz uzunligi 64 bit dan iborat bolishi kerak. Bitta harfimiz jadval bo`yicha
5 bitni bergani uchun dastlabki kalitga 13 ta harfdan iborat soz tanlab olamiz. Ochiq
matnimiz esa 3ta harfdan iborat bu degani 15bit.
M=Ochiq matn=TUR K1=Kalit soz= ToshpulatAlij
Dastlabki kalitni bitlarda ifodalab olamiz.
K1=Kalit soz=
10011011101001000111011111010001011000001001100000010110100001001
64 bitni quyidagi 3ta registorga bolib chiqamiz:

X: 19 bit (x ,x ,x , …,x
0 1 2
18)

Y: 22 bit (y ,y ,y , …,y
0 1 2
21)

Z: 23 bit (z ,z ,z , …,z
0 1 2
22)
Va har bir qadam uchun m=maj(x ,y
8 10,z10) hisoblanadi. masalan: maj(0,1,0) = 0 va maj(1,1,0) = 1 Agar x8=m bo`lsa, tx=x13⊕
x
16 ⊕ x17 ⊕ x18
Agar y
10=m bo`lsa, ty=y20⊕ y21
Agar z
10=m bo`lsa, tz=z7 ⊕z20 ⊕ z21 ⊕ z22 lar hisoblanadi.
Qaysi registor uchun t hisoblansa osha qatorning oxirgi elementi (x
18,y21,z22) ochiriladi. O`sha registor uchun hisoblab topilgan t o`sha
registor boshiga dastlabki bit(x ,y ,z ) sifatida yoziladi.
0 0 0
Shundan song hosil bo`lgan jadvaldagi registor oxirgi elementlari (x
18,y21,z22) xorlanib natijaviy kalitning
elementlari(bitlari) topiladi:
bit= x
18⊕ y21 ⊕ z22
Bizda ochiq matnimiz 15 bit bo`lgani uchun natijaviy kalit ham 15 bit bo`ldi. Bu degani
yuqorida aytilgan ishlar 15 marta (15 round) bo`lib o`tadi.
№
0
1
2
3
4
5
6
7
8
9
1
1
1
1
1
1
1
1
1
1
2
2
2
0
1
2
3
4
5
6
7
8
9
0
1
2
x
1
0
0
1
0
0
0
1
1
1
0
0
0
0
0
0
1
1
0
y
0
1
0
0
1
0
0
1
0
0
0
0
0
0
1
1
0
0
0
1
1
0
z
1
0
0
0
0
1
1
0
1
0
1
1
1
1
0
0
0
0
0
0
1
1
1) m=maj(x ,y
8 10,z10)=maj(1,0,1)=1
t =x
x 13⊕ x16 ⊕ x17 ⊕ x18= 0 ⊕ 1 ⊕ 1 ⊕ 0 = 0
t =z
z 7 ⊕z20 ⊕ z21 ⊕ z22= 0 ⊕ 1 ⊕ 1 ⊕ 0 = 0
0
№
0
1
2
3
4
5
6
7
8
9
1
1
1
1
1
1
1
1
1
1
2
2
2
0 1 2 3 4 5 6 7 8 9 0 1 2
x
0
1
0
0
1
0
0
0
1
1
1
0
0
0
0
0
0
1
1
0
y
0
1
0
0
1
0
0
1
0
0
0
0
0
0
1
1
0
0
0
1
1
0
z
0
1
0
0
0
0
1
0
1
0
1
1
1
1
0
0
0
0
0
0
1
1
1
1
2
2
2
1-bit= x
1
1
0
1
0
18⊕ y21 ⊕ z22=1 ⊕ 0 ⊕ 1=0 2) m=maj(x8,y10,z10)=maj(1,0,0)=0
t =y
y 20⊕ y21 =1 ⊕ 0 = 1
t =z
x 7 ⊕z20 ⊕ z21 ⊕ z22= 1 ⊕ 0 ⊕ 1 ⊕ 1 = 1
№
0
1
2
3
4
5
6
7
8
9
1
1
1
1
1
1
1
0 1 2 3 4 5 6 7 8 9 0 1 2
x
0
1
0
0
1
0
0
0
1
1
1
0
0
0
0
0
0
1
1
0
y
1
0
1
0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r matn = 1 1 0 0 1 1 0 1 1 1 1 0 0 1 0=KOW
Deshifrlash
Disherlash jarayonida bizga shifr matn C va natijaviy kalit K beriladi. C= Shifr matn =KOW = 1 1 0 0 1 1
011110010
K=Key = 0 1 0 1 0 0 0 0 1 1 0 0 0 1 1
Ularni ozaro xorlab ochiq matnga ega bolamiz. Hosil bolgan sonlarni 5 bitdan bolib chiqib jadval orqali
qiymatga mos harflar yozib chiqilib ochiq matn yoziladi.
C= Shifr matn = 1 1 0 0 1 1 0 1 1 1 1 0 0 1 0
K=Key = 0 1 0 1 0 0 0 0 1 1 0 0 0 1 1
M=Ochiq matn= 1 0 0 1 1 1 0 1 0 0 1 0 0 0 1
M=Ochiq matn= 10011 10100 10001= TUR
Download