what you don't know can hurt you
Home Files News &[SERVICES_TAB]About Contact Add New

des.vhd

des.vhd
Posted Dec 21, 1999

des.vhd

tags | encryption
SHA-256 | 01ea92708d4490b5b52e6c0fa2ec58c27590855d3e414bdba4c3f990256c81eb

des.vhd

Change Mirror Download
---------|---------|---------|---------|---------|---------|---------|---------|
-- Author : Tom Vu
-- Date : 09/27/97
-- Description : Left and Right 32-bit registers
-- -----------------------------------------------------------------------------
library ieee;
use IEEE.std_logic_1164.all;
use IEEE.std_logic_arith.all;
use IEEE.std_logic_unsigned.all;
-- -----------------------------------------------------------------------------
entity MESG is

port( CLK : in std_logic;
RST_N : in std_logic;
START : in std_logic;
DONE : in std_logic;
MESSAGE : in std_logic_vector(63 downto 0);
SUBKEY : in std_logic_vector(47 downto 0);
RESULT : out std_logic_vector(63 downto 0)
);

end MESG;

-- -----------------------------------------------------------------------------
architecture beh of MESG is
-- -----------------------------------------------------------------------------

signal IP_KEY : std_logic_vector(63 downto 0);
signal MESG_LEFT : std_logic_vector(31 downto 0);
signal MESG_RIGHT : std_logic_vector(31 downto 0);
signal NEW_L : std_logic_vector(31 downto 0);
signal L : std_logic_vector(31 downto 0);
signal R : std_logic_vector(31 downto 0);
signal EXPANDED_R : std_logic_vector(47 downto 0);
signal X_KEY : std_logic_vector(47 downto 0);
signal S_OUT : std_logic_vector(31 downto 0);
signal FP_IN : std_logic_vector(63 downto 0);
signal FP_OUT : std_logic_vector(63 downto 0);
signal P_IN : std_logic_vector(31 downto 0);
signal P_OUT : std_logic_vector(31 downto 0);

component EX
port(
EX_IN : in std_logic_vector(31 downto 0);
EX_OUT : out std_logic_vector(47 downto 0));
end component;

component IP
port(
IP_IN : in std_logic_vector(63 downto 0);
IP_OUT : out std_logic_vector(63 downto 0));
end component;

component FP
port(
FP_IN : in std_logic_vector(63 downto 0);
FP_OUT : out std_logic_vector(63 downto 0));
end component;

component P
port(
P_IN : in std_logic_vector(31 downto 0);
P_OUT : out std_logic_vector(31 downto 0));
end component;

component S_TABLE
port( KEY : in std_logic_vector(47 downto 0);
S_OUT : out std_logic_vector(31 downto 0));
end component;

begin

MESSAGE1: EX
port map(
EX_IN => R,
EX_OUT => EXPANDED_R);

MESSAGE2: IP
port map(
IP_IN => MESSAGE,
IP_OUT => IP_KEY);

MESSAGE3: S_TABLE
port map(
KEY => X_KEY,
S_OUT => S_OUT);

MESSAGE4: P
port map(
P_IN => S_OUT,
P_OUT => P_OUT);


MESSAGE5: FP
port map(
FP_IN => FP_IN,
FP_OUT => FP_OUT);


-- -----------------------------------------------------------------------------
-- Split_to_LEFT_and_RIGHT: process(IP_KEY)
-- -----------------------------------------------------------------------------
-- begin
-- for i in 0 to 31 loop
-- MESG_RIGHT(i) <= IP_KEY(i);
-- MESG_LEFT(i) <= IP_KEY(i+32);
-- end loop;
-- end process Split_to_LEFT_and_RIGHT;

MESG_RIGHT <= IP_KEY(31 downto 0);
MESG_LEFT <= IP_KEY(63 downto 32);
-- -----------------------------------------------------------------------------
L_AND_R_REG_PR: process(RST_N,CLK)
-- -----------------------------------------------------------------------------
begin
if RST_N = '0' then
L <= (others => '0');
R <= (others => '0');
elsif CLK'event and CLK = '1' then
if (START = '1') then
L <= MESG_LEFT;
R <= MESG_RIGHT;
else
L <= R;
R <= NEW_L;
end if;
end if;

end process L_AND_R_REG_PR;

-- -----------------------------------------------------------------------------
KEY_XOR_PR: process(SUBKEY,EXPANDED_R)
-- -----------------------------------------------------------------------------
begin
for i in 0 to 47 loop
X_KEY(i) <= SUBKEY(i) xor EXPANDED_R(i);
end loop;
end process KEY_XOR_PR;

-- -----------------------------------------------------------------------------
L_XOR_PR: process(L,P_OUT)
-- -----------------------------------------------------------------------------
begin
for i in 0 to 31 loop
NEW_L(i) <= L(i) xor P_OUT(i);
end loop;
end process L_XOR_PR;

-- -----------------------------------------------------------------------------
-- Combine final L and R to FP
-- -----------------------------------------------------------------------------
FP_IN <= NEW_L(31 downto 0) & R(31 downto 0);

-- -----------------------------------------------------------------------------
RESULT_PR: process(RST_N,CLK)
-- -----------------------------------------------------------------------------
begin
if RST_N = '0' then
RESULT <= (others => '0');
elsif CLK'event and CLK = '1' then
if (DONE = '1') then
RESULT <= FP_OUT;
end if;
end if;

end process RESULT_PR;

-- -----------------------------------------------------------------------------
end beh;
-- -----------------------------------------------------------------------------

library ieee;
use IEEE.std_logic_1164.all;
use IEEE.std_logic_arith.all;
use IEEE.std_logic_unsigned.all;
-- -----------------------------------------------------------------------------
entity DES is

port( CLK : in std_logic;
RST_N : in std_logic;
START : in std_logic;
MESSAGE : in std_logic_vector(63 downto 0);
KEY : in std_logic_vector(55 downto 0);
DONE : out std_logic;
CNT : out std_logic_vector(4 downto 0);
DES_OUT : out std_logic_vector(63 downto 0)
);

end DES;

-- -----------------------------------------------------------------------------
architecture beh of DES is
-- -----------------------------------------------------------------------------
signal SUBKEY : std_logic_vector(47 downto 0);
signal DONE_BAK : std_logic;

component MESG
port( CLK : in std_logic;
RST_N : in std_logic;
START : in std_logic;
DONE : in std_logic;
MESSAGE : in std_logic_vector(63 downto 0);
SUBKEY : in std_logic_vector(47 downto 0);
RESULT : out std_logic_vector(63 downto 0)
);
end component;

component KEY_GEN
port( CLK : in std_logic;
RST_N : in std_logic;
START : in std_logic;
KEY_IN : in std_logic_vector(55 downto 0);
DONE : out std_logic;
CNT : out std_logic_vector(4 downto 0);
KEY_OUT : out std_logic_vector(47 downto 0));
end component;

begin

DES1: MESG
port map(
CLK => CLK,
RST_N => RST_N,
START => START,
DONE => DONE_BAK,
MESSAGE => MESSAGE,
SUBKEY => SUBKEY,
RESULT => DES_OUT
);
DES2: KEY_GEN
port map(
CLK => CLK,
RST_N => RST_N,
START => START,
KEY_IN => KEY,
DONE => DONE_BAK,
CNT => CNT,
KEY_OUT => SUBKEY
);

DONE <= DONE_BAK;

end beh;

Login or Register to add favorites

File Archive:

September 2024

  • Su
  • Mo
  • Tu
  • We
  • Th
  • Fr
  • Sa
  • 1
    Sep 1st
    261 Files
  • 2
    Sep 2nd
    17 Files
  • 3
    Sep 3rd
    38 Files
  • 4
    Sep 4th
    52 Files
  • 5
    Sep 5th
    23 Files
  • 6
    Sep 6th
    27 Files
  • 7
    Sep 7th
    0 Files
  • 8
    Sep 8th
    1 Files
  • 9
    Sep 9th
    16 Files
  • 10
    Sep 10th
    38 Files
  • 11
    Sep 11th
    21 Files
  • 12
    Sep 12th
    40 Files
  • 13
    Sep 13th
    18 Files
  • 14
    Sep 14th
    0 Files
  • 15
    Sep 15th
    0 Files
  • 16
    Sep 16th
    21 Files
  • 17
    Sep 17th
    51 Files
  • 18
    Sep 18th
    23 Files
  • 19
    Sep 19th
    48 Files
  • 20
    Sep 20th
    36 Files
  • 21
    Sep 21st
    0 Files
  • 22
    Sep 22nd
    0 Files
  • 23
    Sep 23rd
    38 Files
  • 24
    Sep 24th
    65 Files
  • 25
    Sep 25th
    0 Files
  • 26
    Sep 26th
    0 Files
  • 27
    Sep 27th
    0 Files
  • 28
    Sep 28th
    0 Files
  • 29
    Sep 29th
    0 Files
  • 30
    Sep 30th
    0 Files

Top Authors In Last 30 Days

File Tags

Systems

packet storm

© 2024 Packet Storm. All rights reserved.

Services
Security Services
Hosting By
Rokasec
close