Message Scheduler for SHA1

Status
Not open for further replies.

moursika

Newbie level 1
Joined
May 25, 2009
Messages
1
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Visit site
Activity points
1,287
Hello.

I have to do a message Scheduler for the SHA-1 implementation:

The algorithm says:

Let consider 80 steps(I make this 80 steps by a counter that runs from 0 to 79).
Let denote t as the index of a step. First a 32 bit message block (Wt) is derived for every step from a 512bit Message Block.

For t<16 Wt is simple the 32bit word of the 512 bits.

for t>= Wt = (Wt-3 xor Wt-8 xor Wt-14 xor Wt-16) <<<1 the <<<1 is a circular shift left of 1bit.

can anyone help me ?

This is what i did so far, but It is not working:


Code:
architecture Behavioral of scheduler is

signal s_w0 : std_logic_vector (511 downto 0);
signal s_w  : std_logic_vector (31 downto 0);

begin

process (load,t,clk)
variable s_iw : std_logic_vector (31 downto 0);

begin
  if ((clk = '1') and clk'event) then

      if (load = '1') then                                              -- 0 <= t <= 15 first 512 bit block
		  case t is
		  when "0000000" =>
				s_w <= MessageIn(31 downto 0);
		  when "0000001" =>
				s_w <= MessageIn(63 downto 32);	
		  when "0000010" =>
				s_w <= MessageIn(95 downto 64);
		  when "0000011" =>
				s_w <= MessageIn(127 downto 96);	
		  when "0000100" =>
				s_w <= MessageIn(159 downto 128);
		  when "0000101" =>
				s_w <= MessageIn(191 downto 160);	
		  when "0000110" =>
				s_w <= MessageIn(223 downto 192);
		  when "0000111" =>
				s_w <= MessageIn(255 downto 224);	
		  when "0001000" =>
				s_w <= MessageIn(287 downto 256);
		  when "0001001" =>
				s_w <= MessageIn(319 downto 288);	
		  when "0001010" =>
				s_w <= MessageIn(351 downto 320);
		  when "0001011" =>
				s_w <= MessageIn(383 downto 352);	
		  when "0001100" =>
				s_w <= MessageIn(415 downto 384);
		  when "0001101" =>
				s_w <= MessageIn(447 downto 416);	
		  when "0001110" =>
				s_w <= MessageIn(479 downto 448);
		  when "0001111" =>
				s_w <= MessageIn(511 downto 480);
				s_w0 <= MessageIn;
		  when others =>
				s_w <= x"00000000";
		  end case; 	
		 
      else
		  s_iw := s_w0(95 downto 64) xor s_w0(255 downto 224) xor s_w0(447 downto 416) xor s_w0(511 downto 480);
        s_w <= (s_iw( 30 downto   0) & s_iw( 31));										
		  s_w0(511 downto 0) <= (s_w0(479 downto   0) & s_iw(30 downto 0) & s_iw(31)); 
      end if;
end if;

end process;
  
  W <= s_w;

end Behavioral;
 

Status
Not open for further replies.

Similar threads

Cookies are required to use this site. You must accept them to continue using the site. Learn more…