Question

 

hello guys, I am new to this forum . I am implementing md5 in Verilog. I am almost done with it somehow but still stuck half in a way.. can someone can help me in finding the bug in the rtl. I have referred pancham md5 source code for it and have modified a little bit as per my application. here, are the two attached files kindly help me in solving these issues. have been trying since long. I have to calculate the hash value of about 512 bytes but first of all trying from smaller input values

md5.txt1.txt

pancham_round.txt

Share this post


Link to post
Share on other sites

5 answers to this question

Recommended Posts

  • 0

Hi @akshata@94,

Welcome to the forum! I moved your thread to a section that would get viewed by more fpga experienced forum members. I have not worked with md5 so i'm sure how much help i would be. I have reached out to other forum moderators to see if they would have any input for you. Can you attach the errors you are getting.

cheers,

Jon

Edited by jpeyron

Share this post


Link to post
Share on other sites
  • 0

Hello !! @jpeyron 

yeah actually its  a simulation error. there is some bug in my rtl . I am unable to find the error hence thought this would be a better place to ask .

while implementing md5, since the input message is greater than what the md5 accept as input, for the first 64 rounds it produces proper abcd values . For second rounds,the abcd value are calculated wrong due to which the whole hash value for the md5 input goes wrong. I hope I tried to answer your question

 

Share this post


Link to post
Share on other sites
  • 0

@akshata@94,

Try building your project with Verilator.  On a linux machine, just type "verilator -cc <toplevel-verilog-filename>".  Even if you don't want to simulate using Verilator, the compiler within Verilator can be used to find a lot of bugs.  (For example, you are missing a ; after msg_last.)  I'd produce the full list of bugs found for you, but ... you didn't post all the files to your design, hence Verilator is breaking because it cannot find pancham.h.

Dan

Share this post


Link to post
Share on other sites
  • 0

hello here is the md5.h file and the top module through which input is applied 

module top;

reg clk;

reg rst;

reg [0:511] m_in;

reg [0:12] m_in_w;

reg m_in_val;

reg m_first;

reg m_last;

wire [0:127] m_out;

wire m_out_val;

wire ready;

wire final_op;

//////// instantiation of module md5 //

initlal 

clk =1'b0;

always # 5 clk = ~ clk;

initlal begin 

rst = 1'b1;

m_first = 1'b0'

m_last = 1'b0;

# 12;

rst = 1'b0;

end 

///////////// input message ///

inital begin 

m_in_val = 1'b0;

wait (!rst & ready )

#10 $ display ("---------MD% TEST 0-----------")

m_in = "ponmkljihgfedcbaponmkljihgfedcbaponmkljihgfedcbahgfedcbahgfedcba";

m_in_w = 512;

m_in_val = 1'b1;

m_first = 1'b1;

m_last = 1'b0;

#10;

m_in_val = 1'b0;

m_first = 1'b0;

wait (m_out_val)

if (m_out == 128'hF94980206BA2F6E126C27B32D77DC39F )

$display ("MD5 TEST 0 : PASSED");

the output i get is only upto fd2e5c919c8ecadf362c7f1abc959753 and the further 64 rounds gives me wrong output 

md5.h.docx

Share this post


Link to post
Share on other sites
  • 0

@D@n hey!! i think the error is in msg_appended reg bcz while comparing c code of md5 with verilog code of md5 the m reg which they used during those 4 rounds for the second block is accpeting wrong values

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now