密碼學中,一個S盒Substitution-box替換盒)是對稱密鑰加密算法執行替換計算的基本結構。在塊密碼中,它們通常用於模糊密鑰與密文之間的關係——香農混淆理論[1]

通常,S-Box接受特定數量的輸入比特m,並將其轉換為特定數量的輸出比特n,其中n 不一定等於m[1]。一個m×n的S盒可以通過包含2m條目,每條目n比特的查找表實現。S盒通常是固定的(例如DESAES加密算法), 也有一些加密算法的S盒是基於密鑰動態生成的(例如Blowfish雙魚算法加密算法)。

DES的6×4位S盒(S5)是一個很好的例子:

More information S5, 中間四個比特 ...
S5 中間四個比特
0000 0001 0010 0011 0100 0101 0110 0111 1000 1001 1010 1011 1100 1101 1110 1111
首尾比特 00 0010 1100 0100 0001 0111 1010 1011 0110 1000 0101 0011 1111 1101 0000 1110 1001
01 1110 1011 0010 1100 0100 0111 1101 0001 0101 0000 1111 1010 0011 1001 1000 0110
10 0100 0010 0001 1011 1010 1101 0111 1000 1111 1001 1100 0101 0110 0011 0000 1110
11 1011 1000 1100 0111 0001 1110 0010 1101 0110 1111 0000 1001 1010 0100 0101 0011
Close

給定6比特輸入,將首尾兩個比特作為行條件、中間四個比特(inner four bits)作為列條件進行查表,最終獲得4比特輸出。例如,輸入「011011」,通過首尾兩個比特「01」和中間的比特「1101」進行查表,最終的輸出應該是「1001」[2]

參見

參考文獻

Wikiwand in your browser!

Seamless Wikipedia browsing. On steroids.

Every time you click a link to Wikipedia, Wiktionary or Wikiquote in your browser's search results, it will show the modern Wikiwand interface.

Wikiwand extension is a five stars, simple, with minimum permission required to keep your browsing private, safe and transparent.