--- tags : 資安 --- # ch3 Block Cipher and DES ## Block Cipher 給定n bits的明文就會產出n bits的密文 如果是n bits的block cipher 則Key應該是$n(2^n)$ ## Feistel Cipher ### Diffusion(擴散) and Confusion(混淆) Diffusion是讓明文有一個不一樣,就會讓密文有很大的變化 confusion是讓密文盡可能跟原有的頻率沒有關聯,且鑰匙的複雜度也夠高 ### Feistel Cipher Structure  通式 $LE_i=RE_i-_1$ $RE_i=LE_i-_1 \oplus F(RE_i-_1,K_i)$ 將明文分成兩半$LE_0,RE_0$ RE_0直接等於LE_1 ### Feistel Cipher Design * Block size 越大的區塊大小代表越安全,但是太大的區塊會造成加密/解密的速度變慢 * Key size 跟block 一樣越大越安全但會減慢加密/解密的速度 * Number of rounds 每一輪的加密強度其實是不夠的,但是經過很多輪之後就能把強度提升到一定程度 * Subkey generation algorithm 這裡的演算法越強越好 * Round function F 一樣演算法越強越好 * Fast software encryption/decryption 通常演算法的加密/解密會用軟體來做,因此要有好的軟體才能加快速度 * Ease of analysis 演算法不能太簡單否則會很容易被分析出漏洞 ## Data Encryption Standard (DES) * 在1977年時被發表 * 在2001年AES被發明以前是最廣泛使用的加密法 * DES使用的演算法叫Data Encryption Algorithm (DEA) ### Data Encryption Algorithm (DEA)  一開始會先做Initial permutation (IP) 中間的16回合都是相同的function → Feistel Cipher Structure 最後將兩半交換後(也就是$LE_1$$_7$=$RE_1$$_6$,$RE_1$$_7$=$LE_1$$_6$),做一個反向的Initial permutation,稱為$IP^-$$^1$ ### Single round  圖的右邊為Key的生產方式,左邊為Feistel Cipher Structure ### F Function 首先32bit的輸入會切成4bit一塊,然後將每一塊旁邊多加隔壁塊的bit Ex:...1100 0110 1001... → ...011000 001101 010011... 這樣操作完就會擴增成48bit 之後每一個6bit的區塊都會進入不一樣的S Box,在E-table中加入的2bit決定row,中間的4bit決定column 每個Sbox會有00~ 11的row,和0~15的column  Ex. Input of S1 =011001 => 01 row => 1100=12 column => Output=9=1001 ### Key Generation 首先產生一個64bits的 Key並每8bit捨去一個bit  然後把剩下的打亂後分成兩部分(28bits+28bits)  兩部分分別做left shift,每一round有可能會shift 1~2bits,隨機決定 之後再做一次Permuted Choice(PC2)就得到最後48bits的輸出$K_i$  ### Avalanche Effect 只要明文有1bit不一樣,經過16round的結果也會完全不一樣 就算明文一樣,只要Key不一樣,最後結果也會完全不一樣 ### Timing attacks 原理:通過不同的明文輸入觀察密文產生的時間差來分析可能的金鑰 →不同的輸入確實在DES上會有些微的時間處理的差距,但是目前還不可能用這種方式來破解DES甚至是更強的3DES,AES ## Block Cipher Design Principles 1. Number of Rounds 2. Design of the function F 必須是非線性的,且要有足夠的雪崩效應(Strict avalanche criterion (SAC)) 和位元轉換的獨立性(Bit independence criterion (BIC)) 3. Key scheduling algorithm [CH5 Advanced Encryption Stantard](https://hackmd.io/@Ired/ISch5N0t3)
×
Sign in
Email
Password
Forgot password
or
Sign in via Google
Sign in via Facebook
Sign in via X(Twitter)
Sign in via GitHub
Sign in via Dropbox
Sign in with Wallet
Wallet (
)
Connect another wallet
Continue with a different method
New to HackMD?
Sign up
By signing in, you agree to our
terms of service
.