md5sum makes unaligned word accesses...
Andre
armcc2000 at yahoo.com
Mon May 15 21:35:48 UTC 2006
Rob Landley <rob at landley.net> wrote:
>
> I just changed my copy of md5_hash() to look like:
>
> void md5_hash(const void *data, size_t length, md5_ctx_t *ctx)
> {
> /* We can only call the hash function directly on data that's
> * 32-bit aligned and a multiple of 64 bytes. */
>
> if ((length&63) || (data&3)) md5_hash_bytes(data, length, ctx);
> else md5_hash_block(data, length, ctx);
> }
>
Did you miss my message about the current md5_hash(),
md5_hash_bytes(), md5_hash_block() API being broken regardless to
alignment issues ??
The following fails on all platforms, including x86...
# echo -n "1234" > 4bytes
# echo -n "abcdefghijklmnopabcdefghijklmnop" > 32bytes
# cat 32bytes 32bytes > 64bytes
#
# ( cat 4bytes; sleep 1; cat 64bytes ) | md5sum
Correct answer: 0314c5f1e2d1f87b9481e3a2e08ab452
Busybox answer: 12076da5776df62e0c913dd3dad5d032
Please consider applying the attached patch before any alignment
fixes.
Andre
--
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: patch_md5_api
Type: application/octet-stream
Size: 1328 bytes
Desc: 617868269-patch_md5_api
Url : http://lists.busybox.net/pipermail/busybox/attachments/20060515/c3e8a053/attachment.obj
More information about the busybox
mailing list