資源描述:
《des算法使用vhdl硬件語言實現(xiàn)》由會員上傳分享,免費在線閱讀,更多相關內容在工程資料-天天文庫。
1、實用標準文案libraryieee;useieee.std_logic_1164.all;useieee.std_logic_arith.all;useieee.std_logic_unsigned.all;packagedes_libiscomponentdesport(clk:instd_logic;reset:instd_logic;encrypt:instd_logic;key_in:instd_logic_vector(55downto0);din:instd_logic_vector(63downto0);din_valid:instd_
2、logic;busy:bufferstd_logic;dout:outstd_logic_vector(63downto0);dout_valid:outstd_logic);endcomponent;componentdes_roundport(clk:instd_logic;reset:instd_logic;stall:instd_logic;encrypt_in:instd_logic;encrypt_shift:instd_logic_vector(4downto0);decrypt_shift:instd_logic_vector(4do
3、wnto0);key_in:instd_logic_vector(55downto0);din:instd_logic_vector(63downto0);din_valid:instd_logic;encrypt_out:outstd_logic;key_out:outstd_logic_vector(55downto0);dout:outstd_logic_vector(63downto0);dout_valid:outstd_logic);endcomponent;--Initalpermutationfunctiondes_ip(din:st
4、d_logic_vector(63downto0))returnstd_logic_vector;--Finalpermutationfunctiondes_fp(din:std_logic_vector(63downto0))returnstd_logic_vector;--Keypermutation,convertsa64bitkeyintoa56bitkey,ignoringparityfunctiondes_kp(din:std_logic_vector(63downto0))returnstd_logic_vector;--Compres
5、sionPermutation,convertsa56bitkeyintoa48bits.functiondes_cp(din:std_logic_vector(55downto0))returnstd_logic_vector;--Expansionpermutation精彩文檔實用標準文案functiondes_ep(din:std_logic_vector(31downto0))returnstd_logic_vector;--S-BoxSubstitution,48bitsin,32bitsout.functiondes_sbox(din:s
6、td_logic_vector(47downto0))returnstd_logic_vector;--P-BoxPermutationfunctiondes_pbox(din:std_logic_vector(31downto0))returnstd_logic_vector;--KeyShiftfunctiondes_keyshift(din:std_logic_vector(55downto0);n:std_logic_vector(4downto0))returnstd_logic_vector;enddes_lib;------------
7、----------------------------------------------------------------libraryieee;useieee.std_logic_1164.all;useieee.std_logic_arith.all;useieee.std_logic_unsigned.all;librarywork;usework.des_lib.all;packagebodydes_libis----------------------------------------------------------Inital
8、permutationfunctiondes_ip(din:std_logic_vector(63downt