emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: md5 broken?


From: Antoine Levitt
Subject: Re: md5 broken?
Date: Sat, 28 May 2011 14:28:15 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux)

28/05/11 14:23, Jim Meyering
> Antoine Levitt wrote:
> ...
>> (md5 "truc")
>> => 45723a2af3788c4ff17f8d1114760e62
>> (which is the same thing as md5sum)
>>
>>>From an emacs just compiled,
>>
>> (md5 "truc")
>> => 45723a2aff78ff4fff7fff1114760e62
>> (it seems some digits have been randomly replaced by f, for some reason)
> ...
>
> Thanks for the report.
> That was due to yesterday's crypto_hash_function change.
> It switched from unsigned to signed char pointers.
> The patch below fixes it by introducing the tiny "to_uchar" function
> from coreutils/src/system.h.  It's safer to use a tiny helper
> function like that rather than a cast.
>
> I fixed it with this:
>
> 2011-05-28  Jim Meyering  <address@hidden>
>
>       avoid a sign-extension bug in crypto_hash_function
>       * fns.c (to_uchar): Define.
>       (crypto_hash_function): Use it to convert some newly-signed
>       variables to unsigned, to avoid sign-extension bugs.  For example,
>       without this change, (md5 "truc") would evaluate to
>       45723a2aff78ff4fff7fff1114760e62 rather than the expected
>       45723a2af3788c4ff17f8d1114760e62.  Reported by Antoine Levitt in
>       http://thread.gmane.org/gmane.emacs.devel/139824

Thanks for the fix! Awesome that the word "truc" ("thingy" in french)
has made its way into the emacs Changelog ;)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]