News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

md5 hashing

Started by ninjarider, July 04, 2007, 09:41:24 PM

Previous topic - Next topic

ninjarider

anybody know how it works


ninjarider

im currently reading
http://www.ietf.org/rfc/rfc1321.txt

was wondering if anybody has actually worked with it. or had any projects to work with.

Shantanu Gadgil

Quoteim currently reading

The source code at the end of the RFC works OK.

Used the code to hash large file too ... work fine!

Regards,
Shantanu
To ret is human, to jmp divine!

Tedd

It's quite straightforward to implement, just as long as you follow the instructions correctly (and check your results with the examples given.)
The RFC gives all of the information you need, and source code; and there are a few examples on the forum :wink

How it works (without detail): take the input data, segment it into equal size blocks (apply padding to the last block), apply a transformation to each block, combine the blocks progressively, produce the resulting hash value. Easy :lol
No snowflake in an avalanche feels responsible.

drhowarddrfine

The web site I am creating, I use it to generate a customer id based on his ip, date/time, and a wildcard value. 

evlncrn8

Quote from: drhowarddrfine on July 05, 2007, 02:54:35 PM
The web site I am creating, I use it to generate a customer id based on his ip, date/time, and a wildcard value. 

i hope you're aware of md5 collision problems... :)

Tedd

Quote from: evlncrn8 on July 05, 2007, 03:32:37 PM
i hope you're aware of md5 collision problems... :)
Any kind of hash is going to have collisions (unless you know all of the values to be hashed in advance - then you can cheat) - you're trying to map a large number range onto a smaller one, obviously some values will have to 'collide.'
No snowflake in an avalanche feels responsible.

drhowarddrfine

The collision problem is avoided because the wildcard number is known only to us, at least as far as any security flaws are concerned, plus the id is only valid for 30 minutes and ids are checked for duplicates before being issued.

AkinforASM

Quote from: evlncrn8 on July 05, 2007, 03:32:37 PM
i hope you're aware of md5 collision problems... :)

While using pascal, I even sometimes encounter collisions with SHA256  :dazzled:.

ninjarider

ok. i understand most of it except 1 thing

at this site http://en.wikipedia.org/wiki/MD5

they use the variable w[]

they have it listed on the site as a word. did they mistype that and it needs to be double word.

Tedd

'word' simply means "the word size of the machine" - so for a 32-bit machine the word-size is 32-bits ('dword') and for a 16-bit machine it is 16-bits ('word').

It causes some confusion as we tend to use 'word' (not 'word-size') to mean a 16-bit word -- the reason for this is historical, but unfortunately it's stuck.
Anyway, no they haven't made a mistake, it says "sixteen 32-bit little-endian words" which means: 16 DWORDs, little-endian byte-order.
No snowflake in an avalanche feels responsible.

ninjarider

 k := floor(abs(sin(i + 1)) × (2 pow 32))

what in the world is floor() suppose to do.

Ian_B

#13
I hate to see people totally wasting time re-inventing the wheel.

I posted fast MD5 code on the old forum, and I was prompted to update it slightly recently. You'll find the original MD5 Rivest specification in this zip to see how the code follows the spec exactly. Note it is not neatly tidied into Macros like some simple versions you may see around, as that doesn't allow full optimisation.

http://www.i-asm.com/MD5v2a.zip

EDIT: minor update in zipped code

IanB

ninjarider

dont know why i want to know. but how do you go about using that function on the windows calculator. and for some reason i cant remember what abs does.