/ệL1RLDX 7KHJLệLFXíDFKXQJWDOXRQVRLVXẹFWURQJPXRQYDQELHQểRặQJểỉệẹFWDẹRUDEệíLFRQ QJỉệL9DWURQJWKHN\íQD\PD\WẽQKODPRặWWURQJQKỉìQJVDíQSKDầPYếểDẹLQKDW&XQJ YệLWKệLJLDQQJỉệLWDNKRQJPXRQVỉíGXẹQJPRặWPD\WẽQKểệQOHíQỉìDPDVHìNHWQRLFDF PD\QD\ODẹLWKDQKPRặWPDẹQJPD\WẽQKQKDấPWDèQJNKDíQDèQJODPYLHặFKLHầXELHWWUDRểRầL FDặSQKDặWFDFWKRQJWLQg0DẹQJ,QWHUQHWOD[XKỉệQJSKDWWULHầQFXíDWKHJLệLQJD\QD\+LHặQ QD\,QWHUQHWểDìWUệíQHQUDWSKRầELHQWUHQWRDQWKHJLệL 7KRQJTXDPDẹQJ,QWHUQHWPRẹL QJỉệLFRWKHầWUDRểRầLWKRQJWLQYệLQKDXPRặWFDFKQKDQKFKRQJWKXDặQWLHặQ1KỉìQJFRQJW\ SKDWWULHầQYDNLQKGRDQKWUHQPRLWUỉệQJ,QWUDQHW,QWHUQHWKRẹSKDíLểRLGLHặQYệLNKRNKDèQ OệQODODPWKHQDRểHầEDíRYHặQKỉìQJGỉìOLHặXTXDQWURẹQJQJDèQFKDQQKỉìQJKẻQKWKỉFWDQ FRQJWUX\[XDWGỉìOLHặXEDWKệẹSSKDSWỉEHQWURQJ,QWUDQHWODQFDíEHQQJRDL,QWHUQHW .KLPRặWQJỉệLPXRQWUDRểRầLWKRQJWLQYệLPRặWQJỉệLKD\PRặWWRầFKỉFQDRểRWKRQJTXD PDẹQJPD\WẽQKWKẻ\HXFDXTXDQWURẹQJODODPVDRểHầểDíPEDíRWKRQJWLQNKRQJEễVDLOHặFK KRDFEễORặGRVỉẹ[DPQKDặSFXíDNHíWKỉED7UỉệFFDF\HXFDXFDQWKLHWểRPRặWVRJLDíL WKXDặWPDìKRDểDìGỉệẹF[D\GỉẹQJQKDấPểDíPEDíRWẽQKDQWRDQGỉìOLHặXWDẹLQệLOỉXWUỉìFXìQJ QKỉNKLGỉìOLHặXểỉệẹFWUX\HQWUHQPDẹQJQKỉFDFJLDíLWKXDặWPDìKRDểRL[ỉQJ (DES), JLDíL WKXDặWPDìKRDFRQJNKDL, 9LHặFWẻPKLHầXYD[D\GỉẹQJFKỉệQJWUẻQKFDFJLDíLWKXDặWQD\ FXìQJNKRQJQDấPQJRDLPXẹFểẽFKFXíDEDíQOXDặQYDèQQD\/XDặQYDèQFRQKLHặPYXẹWẻPKLHầXO\ WKX\HWYHPDặWPDìKRDWKRQJWLQ[D\GỉẹQJVHUYHUWDẹRNKRDFKR user trong YDQểHEDíR PDặWGỉìOLHặX. 'RWKệLJLDQYDNKDíQDèQJFRKDẹQWURQJNKLSKDẹPYLểHWDLODẹLURặQJQKỉìQJQJỉệL WKỉẹFKLHặQFKẩFRWKHầWẻPKLHầXểỉệẹFPRặWVRJLDíLWKXDặWFKẽQKQKỉ'(6(&%&%&56$ 0'YDTXDểRểỉDUDPRKẻQKVHUYHUWDẹRNKRDFKRFDFXVHUFXẹWKHầODODPWKHQDRểHầ TXDíQO\YDSKDQSKRLNKRDPRặWFDFKDQWRDQKLHặXTXDí&KDậFFKDậQUDấQJWDặSWKX\HWPLQK QD\VHìNKRQJWUDQKNKRíLQKỉìQJWKLHXVRWQJỉệLWKỉẹFKLHặQPRQJQKDặQểỉệẹFVỉẹJRS\FKẩ GDQWKHPFXíDFDF7KD\&REDẹQEHểHầEDíQWKX\HW PLQKểỉệẹFKRDQWKLHặQKệQ&KXQJ WRL[LQFKDQWKDQKFDíPệQ7KD\KỉệQJGDQFDF7KD\&RWURQJNKRDểDìWDẹRểLHX NLHặQWKXDặQOệẹLểHầEDíQWKX\HWPLQKQD\FRWKHầKRDQWKDQKểXQJWKệLKDẹQ &KỉệQJ &DFKHặPDặWPDì +HặPDặWPDìểRL[ỉQJ *LệLWKLHặX &DFJLDíLWKXDặWPDặWPDìểRL[ỉQJODFDFJLDíLWKXDặWVỉíGXẹQJFXQJPRặWNKRDEẽPDặW FKRWDFYXẹPDìKRDYDWDFYXẹJLDíLPDì9ẽGXẹQKỉFDFJLDíLWKXDặWWKD\WKHYDKRDQYễJLDíL WKXDặW '(6g ảẵ ểD\ WD FKẩ WẻP KLHầX JLDíL WKXDặW '(6 'DWD (QFU\SWLRQ 6WDQGDUG OD JLDíL WKXDặWPDặWPDìểRL[ỉQJểỉệẹFVỉíGXẹQJSKRầELHQQKDW *LDíLWKXDặW'(6'DWD(QFU\SWLRQ6WDQGDUG 9DRQDèP1DWLRQDO%XUHDXRIVWDQGDUGểDìểỉDUDFKXDầQ'(6ểHầVỉíGXẹQJ FKRFDFỉQJGXẹQJệí0\ì'(6PDìKRDFDFNKRLGDWDELWVYệLNKRDELWV*LDíLWKXDặW GXQJểHầPDìKRDODQJLDíLPDìểỉệẹFPRWDíWRPWDậWQKỉKẻQK 7UỉệFWLHQELWLQSXW7ểỉệẹFKRDQYễEệíLSKHSKRDQYễKRDQYễNKệíLểRặQJ,3YệL 7R ,376DXNKLTXDYRQJODSPRLYRQJVỉíGXẹQJPRặWNKRDELWểỉệẹFWDẹRUDWỉ NKRDLQSXWELWVYệLWDFểRặQJFXíDKDP)QRểỉệẹFKRDQYễEDấQJSKHSKRDQYễểDíR,3 ểHầWDẹRUDELWRXWSXWFXRLFXQJ,3YD,3 ểỉệẹFFKRWURQJFDFEDíQJEDíQJDYDEDíQJ E&DFEDíQJQD\ểỉệẹFểRẹFWỉWUDLVDQJSKDíLWỉWUHQ[XRQJGỉệLWKHRGDẹQJ 7 W W gW ặ7 W W ggW DXWLHQNKRL7 ểỉệẹFWDFKWKDQKKDLNKRLWUDLYDSKDíLPRLNKRLELWV 7 / 5 YệL/ W gW 5 W gW ảẵYRQJODSWKỉLL/ 5 5 / )5 . WURQJểROD SKHSFRặQJH[FOXVLYHBRUYD. ODNKRDELWVảẵYRQJODSFXRLFXQJFDFQKDQKWUDLYD SKDíLNKRQJểRầLFKRFKRQKDXYẻYDặ\LQSXWFXíD,3 OD5 / +DP)YD6BER[HVKẻQK 7UỉệFWLHQ5 ểỉệẹFPệíURặQJWKDQKNKRLELWV(5 YệL(ODEDíQJOỉẹDFKRẹQELW ểỉệẹFFKRWURQJEDíQJ6DXểRWKỉẹFKLHặQSKHS;25(5 YệL. YDNHWTXDíểỉệẹFWDFK WKDQKNKRLELWWỉ% WệL% (5 . % % % 0RLNKRL% VDXểRểỉệẹFểỉDYDRPRặWKDP6 6ER[6 % WUDíYHPRặWNKRLELW EDíQJ&DFNKRLQD\ểỉệẹFQRLODẹLYD NKRLNHW TXDíELWểỉệẹFKRDQYễEDấQJSKHS3 EDíQJ )5 . 36 % g6 % +RDẹWểRặQJFXíD6ER[VRQJX\HQWỉệQJỉQJYệLE E VHìFKRẹQ5RZWURQJEDíQJFRQ VRQJX\HQWỉệQJỉQJYệLE E E E VHìFKRẹQ&ROXPQ*LDWUễFXíD6 % ểỉệẹFFKRẹQVHìODPRặW VRQJX\HQELWệíYễWUẽ5RZYD&ROXPQểR 7ẽQKNKRDKẻQK '(6WDẹRUDNKRDPRLNKRDFKLHXGDLELWWỉPRặWNKRDLQSXWELWGXQJFKR YRQJODS/ỉXểRWẽQKWRDQNKRDểỉệẹFFKRWURQJKẻQK .KRDLQSXWODPRặWNKRLELWYệLELWSDULW\WDẹLFDFYễWUẽg3HUPXWDWLRQ 3&VHìORDẹLERíFDFELWSDULW\YDVHìKRDQYễELWFRQODẹLWKHREDíQJ.HWTXDí3&. VDXểRểỉệẹFFKLDWKDQKKDLSKDQ& YD' PRLSKDQELW.KRD. GXQJWURQJYRQJWKỉL ểỉệẹFWDẹRUDWỉ& YD' WKHRTX\WDậFQKỉVDXWURQJFDFYRQJYD& YD' ểỉệẹFTXD\YRQJPRặWEẽWTXDWUDLWURQJFDFYRQJFRQODẹLWKẻểỉệẹFTXD\YRQJKDLEẽWTXD WUDL4XDSKHSTXD\YRQJQD\& YD' VHìểỉệẹFELHQểRầLWKDQK& YD' +RDQYễ&YD ' WKHREDíQJ6DXNKLKRDQYễ& ERíTXDFDFEẽWWDẹRWKDQKQỉìDWUDLFXíD. EẽWFRQ' ERíểLFDFEẽWWDẹRUDQỉìDSKDíLFXíD. EẽW*KHSQỉìDWUDL YDQỉìDSKDíLWDẹRUDNKRD. EẽW *LDíLPDì 4XDWUẻQKJLDíLPDìểỉệẹFWKỉẹFKLHặQWKHRFXQJJLDíLWKXDặWQD\WKHRWKỉWỉẹQJỉệẹFODẹL QKỉVDX,3 ODểDíRFXíD,3YDệíYRQJODSWKỉLVỉíGXẹQJNKRD. . ệíYRQJODSểDXWLHQ . ệíYRQJODSFXRLFXQJYD 5 / / 5 )/ . Input .KÖÝLWDÑRKRDÛQYÔ L 1 =Ro Ro + F + F + F ³DÝRNKÖÝLWDÑRKRÛDQYÔ 2XWSXW Lo R 1 = Lo + F(R 1 ,K 1 ) L 15 = R 14 R 2 = L 1 + F(R 1 ,K 2 )L 2 = R 1 R 15 = L 14 + F(R 14 ,K 15 ) + F R 16 = L 15 + F(R 15 ,K 16 ) L 16 = R 15 1,2,3, 64 1,2,3, 64 1,2,3, 32 K 1 K 2 Kn K 16 Hình 1: Encr y ption computation 1,2,3, 32 &KRÑQKRÛDQYÔ /HIW6KLIW /HIW6KLIW /HIW6KLIW/HIW6KLIW /HIW6KLIW /HIW6KLIW &KRÑQKRÛDQYÔ &KRÑQKRDÛQYÔ &KRÑQKRDÛQYÔ 1,2,3, 64 1,2,3, 28 1,2,3, 28 K 1 Kn K 16 +ÎQK Key Schedule Calculation Key Key Key C 1 D 1 Cn Dn C 16 D 16 S 1 S 2 S 3 S 6 S 5 S 7 S 4 S 8 P 32 bits + E 48 bits K ( 48 bits ) 5 ELWV Hình 3 : Calculation of f(R,K) 6 4 %DÝQJD%DÝQJKRDÛQYÔÓDÂXWLHÄQ,3 %DÝQJE%DÝQJKRDÛQYÔFXRÃLFXÚQJ,3 %DÝQJ%DÝQJFKRÑQEÏW( %DÝQJ%DÝQJKRDÛQYÔ3 %DÝQJ%DÝQJKRDÛQYÔNKRÛD3& %DÝQJ%DÝQJKRDÛQYÔNKRÛD3& &ROXPQ 5RZ%R[ 6 6 6 6 6 6 6 6 %DÝQJ%DÝQJFKRÑQ6ER[H[ '(6,Q(OHFWURQLF&RGH%RRN0RGH(&% ảẵPRGHQD\FDFNKRLGDWDGỉệLGDẹQJURíFOHDUWH[WểỉệẹFểỉDYDRLQSXWFXíD'(6 &DFNKRLNHWTXDíGỉệLGDẹQJPDặWPDìFLSKHUWH[WFRWKHầểỉệẹFVỉíGXẹQJFKRFDFỉQJGXẹQJ NKDF4XDWUẻQKELHQểRầLGLHQUDQKỉVDXKẻQK &OHDUWH[Wặ,QSXWEORFNặ'(6ặ2XWSXWEORFNặ&LSKHUWH[W (&%HQFU\SWLRQ (&%GHFULSWLRQ +ẻQK(OHFWURQLF&RGHERRN0RGH(&% '(6,Q&LSKHU%ORFN&KDLQLQJ0RGH&%& .KRLGDWDFDQPDìKRDểỉệẹFFKLDWKDQKFDFNKRL% % g% YệLNẽFKWKỉệFPRL NKRLODELWV9HFWệNKệíLWDẹR,9ELWVểỉệẹFFKRẹQ6ệểRPDặWPDìểỉRẹFFKRWURQJKẻQK 4XDWUẻQKPDìKRD ,9% & &OHDUWH[W ' ' ' ,QSXWEORFN , , g, '(6HQFU\SW 2XWSXWEORFN 2 2 g2 &LSKHUWH[W & & g& &OHDUWH[W ' ' ' &LSKHUWH[W & & g& ,QSXWEORFN , , g, '(6GHFU\SW 2XWSXWEORFN 2 2 g2 & ⊕% & Q& ⊕% & 4XDÛWUÎQKJLDÝLPD× & ,9⊕% ,9⊕% ⊕,9 % & & ⊕% & ⊕% ⊕& % & &⊕% & ⊕% ⊕& % +ÎQK&LSKHU%ORFN&KDLQLQJ&%&PRGH ,9 % % % Time = 1 Time = 2 Time = n + + + ,,, '(6HQFU\ '(6HQFU\ '(6HQFU\ & & & , , , '(6GHFU\ '(6GHFU\ '(6GHFU\ ,9 + + + %% % 0D×KRÛD *LDÝLPD×