Thuat Toan Des

  • View
    62

  • Download
    0

Embed Size (px)

Text of Thuat Toan Des

  • 5/27/2018 Thuat Toan Des

    1/23

    THUT TON DES(THE DATA ENCRYPTIONSTANDARD)

    Sinh vin thc hin:

    Phan Cng Ngn 1063287

    Trn Quc Quang 1063299

  • 5/27/2018 Thuat Toan Des

    2/23

    LCH S CA THUT TONDES

    - Ngy 13/5/1973 y ban quc gia v tiuchun ca M cng b yu cu v h mtm p dng cho ton quc. iu ny

    t nn mng cho chun m ha d liu,hay l DES.- Lc u Des c cng ty IBM pht trin

    t h m Lucifer, cng b vo nm 1975.- Sau Des c xem nh l chun m

    ha d liu cho cc ng dng.

  • 5/27/2018 Thuat Toan Des

    3/23

    CU TRC THUT TON

    DES l thut ton m ha khi, di mikhi l 64 bit .

    Kha dng trong DES c di ton b l64 bit. Tuy nhin ch c 56 bit thc sc s dng; 8 bit cn li ch dng chovic kim tra.

    Des xut ra bn m 64 bit.

  • 5/27/2018 Thuat Toan Des

    4/23

    M T THUT TON

    Thut ton c thc hin trong 3 giai on:

    1. Cho bn r x (64bit) c hon v khi toIP (Initial Permutation) to nn xu bit x

    0.x0=IP(x)=L0R0

    L0l 32 bit u tin ca x0.R0l 32 bit cui ca x0.

  • 5/27/2018 Thuat Toan Des

    5/23

    B CHUYN V IP

    58 50 42 34 26 18 10 2

    60 52 44 36 28 20 12 4

    62 54 46 38 30 22 14 6

    64 56 48 40 32 24 16 8

    57 49 41 33 25 17 9 1

    59 51 43 35 27 19 11 3

    61 53 45 37 29 21 13 5

    63 55 47 39 31 23 15 7

  • 5/27/2018 Thuat Toan Des

    6/23

    M T THUT TON (tt.)2. Tnh 16 vng lp ca mt hm xc nh. Ta s tnh L

    i

    Rivi 1

  • 5/27/2018 Thuat Toan Des

    7/23

    Mt vng ca qu trnh lp m c m t qua hnh sau:

  • 5/27/2018 Thuat Toan Des

    8/23

    M T THUT TON

    3. p dng hon vngc IP-1cho xu bitR16L16ta nhn c

    bn m y.y= IP-1(R16L16).

    40 8 48 16 56 24 64 32

    39 7 47 15 55 23 63 31

    38 6 46 14 54 22 62 30

    37 5 45 13 53 21 61 29

    36 4 44 12 52 20 60 28

    35 3 43 11 51 19 59 27

    34 2 42 10 50 18 58 26

    33 1 41 9 49 17 57 25

    Hon v IP-1

  • 5/27/2018 Thuat Toan Des

    9/23

    Hm f

    1. i s u Ris c m rng thnh xu c

    di 48 bit tng ng vi hm m rng E cnh.E(Ri) bao gm 32 bit t Ri, c hon v theomt cch thc xc nh, vi 16 bit c to ra

    2 ln.

    Hm f ly i s u l xu nhp Ri(32 bit)i s th hai l Ki(48bit) v to ra xu xut c di 32 bit. Cc bc sau c thc hin.

  • 5/27/2018 Thuat Toan Des

    10/23

    Hm f (tt.)

    32 1 2 3 4 5

    4 5 6 7 8 9

    8 9 10 11 12 13

    12 13 14 15 16 17

    16 17 18 19 20 21

    20 21 22 23 24 25

    24 25 26 27 28 29

    28 29 30 31 32 1

    Hm m rng E

  • 5/27/2018 Thuat Toan Des

    11/23

    2. Tnh E(Ri) Ki v vit kt qu nh l ni ca 8xu 6bit.

    B=B1B2B3B4B5B6B7B83. Bc k tip l s dng 8 S-box (S1 ,S2, ,S8).Mi Si l mt mng 4x16 c nh c cc phn tl cc s 0 n 15.

    Cho xu c di 6 bit Bj= b1b2b3b4b5b6, tatnh Sj(Bj) nh sau: Hai bit b1b6xc nh biudin nh phn ca hng r ca Sj (0

  • 5/27/2018 Thuat Toan Des

    12/23

    14 4 13 1 2 15 11 8 3 10 6 12 5 9 0 7

    0 15 7 4 14 2 13 1 10 6 12 11 9 5 3 8

    4 1 14 8 13 6 2 11 15 12 9 7 3 10 5 0

    15 12 8 2 4 9 1 7 5 11 3 14 10 0 6 13

    b2b3b4b5=1100

    b1b6=00

    Hp S1

    - Mi xu xut 4 bit ca cc hp S c a vocc Cj tng ng: Cj = Sj(Bj) (1

  • 5/27/2018 Thuat Toan Des

    13/23

    4. Xu bit C = C1C2C3C4C5C6C7C8c di 32bit c hon v tng ng vi hon v cnh P. Kt qu c P(C)= f(R

    i,K

    i).

    16 7 20 21

    29 12 28 17

    1 15 23 265 18 31 10

    2 8 24 14

    32 27 3 9

    19 13 30 622 11 4 25

    Hon v P

  • 5/27/2018 Thuat Toan Des

    14/23

    S hm f

    F

  • 5/27/2018 Thuat Toan Des

    15/23

    Kha K

    - K l mt xu c di 64 bit trong 56bit dng lm kha v 8 bit dng kimtra s bng nhau (pht hin li).

    - Cc bit cc v tr 8, 16,, 64 c xcnh, sao cho mi byte cha s l cc s1, v vy tng li c th c pht hintrong mi 8 bit.

    - Cc bit kim tra s bng nhau l c bqua khi tnh lch kha.

  • 5/27/2018 Thuat Toan Des

    16/23

    Qu trnh to cc kha con (subkeys) t kha Kc m t nh sau:

    1. Cho kha K 64 bit, loi b cc bit kimtra v hon v cc bit cn li ca K tngng vi hon v c nh PC-1. Ta vit

    PC1(K) = C0D0, vi C0bao gm 28 btu tin ca PC-1(k) v D0l 28 bit cnli.

  • 5/27/2018 Thuat Toan Des

    17/23

    Cc hon v c nh PC-1 v PC-2:

    57 49 41 33 25 17 9

    1 58 50 42 34 26 18

    10 2 59 51 43 35 27

    19 11 34 60 52 44 36

    63 55 7 39 31 23 15

    7 62 54 46 38 30 22

    14 6 61 53 45 37 29

    21 13 5 28 20 12 4

    14 17 11 24 1 5

    3 28 15 6 21 10

    23 19 12 4 26 8

    16 7 27 20 13 2

    41 50 31 37 47 55

    30 40 51 45 33 48

    44 49 39 56 34 53

    46 42 50 36 29 32

    PC1

    PC2

  • 5/27/2018 Thuat Toan Des

    18/23

    2. Vi i nm trong khong t 1 n 16, ta tnh Ci, Dinh sau:

    for(i=1;i

  • 5/27/2018 Thuat Toan Des

    19/23

    S to cc kha con

  • 5/27/2018 Thuat Toan Des

    20/23

    Gii m

    Vic gii m dng cng mt thut tonnh vic m ho.

    gii m d liu c m ho, qu

    trnh ging nh m ho c lp li nhngcc cha kho ph c dng theo th tngc li t K16n K1, ngha l trongbc 2 ca qu trnh m ho d liu uvo trn Ri-1s c XOR vi K17-ichkhng phi vi Ki.

  • 5/27/2018 Thuat Toan Des

    21/23

    c im ca m DES

    1. Tnh cht b ca m DES:DES c tnh cht b:

    trong :l phn b ca A theo tng bt (1 thay bng

    0 v ngc li).EKl bn m ha ca E vi kha K. Pv Cl vn

    bn r (trc khi m ha) v vn bn m (sau khi mha).

    Do tnh b, ta c th gim phc tp ca tn cngduyt ton b xung 2 ln (tng ng vi 1 bt) viiu kin l ta c th la chn bn r.

  • 5/27/2018 Thuat Toan Des

    22/23

    2. Cc kha yu trong m Des:

    Ngoi ra DES cn c 4 kha yu (weak keys).Khi s dng kha yu th m ha (E) v gii m(D) s cho ra cng kt qu:

    EK(EK(P)) = Por equivalently, EK= DK

    Bn cnh , cn c 6 cp kha na yu

    (semi-weak keys). M ha vi mt kha trongcp, K1, tng ng vi gii m vi kha cnli, K2:

    EK1(EK2(P))=Por equivalently EK1=DK2

    Tuy nhin c th d dng trnh c nhngkha ny khi thc hin thut ton, c th bngcch th hoc chn kha mt cch ngu nhin.Khi kh nng chn phi kha yu l rt nh.

  • 5/27/2018 Thuat Toan Des

    23/23

    3. Trip le DES:

    Triple-DES chnh l DES vi hai cha kho 56 bit.Cho mt bn tin cn m ho, cha kho u tin cdng m ho DES bn tin .

    Kt qu thu c li c cho qua qu trnh gii mDES nhng vi cha kho l cha kho th hai.

    Bn tin sau qua c bin i bng thut tonDES hai ln nh vy li c m ho DES mt ln navi cha kho u tin ra c bn tin m ho cuicng.

    Qu trnh m ho DES ba bc ny c gi lTriple-DES.