sha1sum / md5sum problems

Denis Vlasenko vda.linux at googlemail.com
Fri Jan 26 23:29:42 UTC 2007


On Friday 26 January 2007 21:58, MatthewLCreech at eaton.com wrote:
> busybox-bounces at busybox.net wrote:
> > 
> > 1.3.2: "d2affe6e6252c5de244012d941fdb59fc9cdc579"
> > 1.4.0: "T2QVVU6U6252S5TU244012T941VTR59VS9STS579"
> > 
> > The strings are very similar - it appears that all numbers
> > are correct,
> > while letters are offset by a contant amount.  Any ideas?
> > 
> 
> FYI, It seems that "libbb/xfuncs.c:bin2hex()" is buggy.  Not sure what
> the problem is, but I reverted "coreutils/md5_sha1_sum.c" to its
> previous version which doesn't call that function, and it works fine
> now.

Awwww you right. Fix is.

diff -urpN busybox.4/libbb/xfuncs.c busybox.5/libbb/xfuncs.c
--- busybox.4/libbb/xfuncs.c    2007-01-24 22:49:26.000000000 +0100
+++ busybox.5/libbb/xfuncs.c    2007-01-27 00:27:45.000000000 +0100
@@ -343,8 +343,8 @@ char *bin2hex(char *p, const char *cp, i
        while (count) {
                unsigned char c = *cp++;
                /* put lowercase hex digits */
-               *p++ = 0x10 | bb_hexdigits_upcase[c >> 4];
-               *p++ = 0x10 | bb_hexdigits_upcase[c & 0xf];
+               *p++ = 0x20 | bb_hexdigits_upcase[c >> 4];
+               *p++ = 0x20 | bb_hexdigits_upcase[c & 0xf];
                count--;
        }
        return p;

Fixed in svn, thanks!
--
vda



More information about the busybox mailing list