[Top][All Lists]

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

md5 broken?

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


I've got this code, that hashes ERC nicks to get a color (the same every
time) for every nick.

(defun erc-get-color-for-nick (nick)
  "Gets a color for NICK. If NICK is specified
  in erc-nick-color-alist, use it, else hash
  the nick and get a color from that"
  (or (cdr (assoc nick erc-nick-color-alist))
       (mod (string-to-number
             (substring (md5 nick) 0 6) 16)
            (length erc-colors-list))

Recently (between yesterday and today), some colors have changed.

>From an emacs compiled 2011-05-26 13:47 (GMT+1) (just the binary, with
same elisp),

(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)

The only likely culprit I can see is the integer overflow fixes:

revno: 104390 [merge]
committer: Paul Eggert <address@hidden>
timestamp: Fri 2011-05-27 13:32:41 -0700
  Merge: Integer overflow fixes.

Could someone look into that, please? I'm on x86-64 by the way.

reply via email to

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