How to apply DES Sbox 1?

9 次查看(过去 30 天)
lilly lord
lilly lord 2023-6-28
评论: lilly lord 2023-6-29
Hi. I want to apply DES Sbox1.
S-box1= [ 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 ];
num=[15 23 19 12 8];
N=de2bi(num,6,'left-msb');
I want to apply sbox on N.
If any one can help...

回答(1 个)

Image Analyst
Image Analyst 2023-6-29
You can't have a subtraction operation on the left wide of an equals sign:
S-box1 = ...............
The right side of the equals sign needs to be put into a variable, not an expression (a subtraction operation, like S minus box1)
What is sbox? And what does it mean to "apply" sbox on N?
  2 个评论
lilly lord
lilly lord 2023-6-29
Yes you are right . Its should be S_box1. The image below, shows the entries of S_box1.
If we want to replace 15. Then first convert into 6-bit binary i.e 001111.
The left most bit 0 and the right most bit 1 together become 01 determines the row, which is 1.
the inner bits 0111 (which is 7) determines the coloumn.
By looking at the table , the entry at (1,7) gives 1.
The above example takes 6-bit input i.e 110010, The left and right most bits 10 means row number 2 and the inner bits are 1001 means 9 so the col number is 9. the corresponding value at (2,9) is 12 so the six bit number is replaced by 12.
What is sbox?
Sbox or the substitution box used in block ciphers to hide any linear relationship between input and output bits. The Sbox shared is a part of the first modern block cipher. And it is not classified. One can find the implementation of the whole algorithm in https://www.mathworks.com/matlabcentral/fileexchange/37847-data-encryption-standard-des
I want to only use one Sbox and the above algorithm shared is very complicated.
lilly lord
lilly lord 2023-6-29
DES is not classified. And it doesnot violate any laws. Rather it is used to for teaching purpose.

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Encryption / Cryptography 的更多信息

标签

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by