Near Final PEP 247 - API for Cryptographic Hash Functions
boyd at insultant.net
Sat Sep 29 01:20:27 CEST 2001
"Andrew Kuchling" <akuchlin at mems-exchange.org> a écrit dans le message news: mailman.1001707952.19388.python-list at python.org...
> We program in a byte-oriented world. :)
MD5 is _bit_ orientated.
> >What exactly does update() do? Does it replace or append?
> "Append", meaning that the string is hashed into the current state of
> the object.
it has to appended to the current MD5 block. when you have
a whole block you can process the block. could you clarify
what you just said?
the digest is computed on the padded block and it's length:
/* pad message */
*me++ = 0x80;
if ((me - mb) > MSG_LEN0_BYTE)
/* digest this block and substitute a padded block */
bzero(me, MSG_BYTES - (me - mb));
bzero(me, MSG_LEN0_BYTE - (me - mb));
/* append size in bits */
if you want all the code:
More information about the Python-list