diff options
author | Ben Longbons <b.r.longbons@gmail.com> | 2011-04-02 10:53:48 -0700 |
---|---|---|
committer | Ben Longbons <b.r.longbons@gmail.com> | 2011-04-02 10:53:48 -0700 |
commit | 7a1b57a80346c1b5f2b2c5b8f0899167bf2fd9b1 (patch) | |
tree | 6a925a49b00d982790d8800119193904f1ec2af7 /src/common | |
parent | deec3c27f91a97d35aaf912422d1249ec609da05 (diff) | |
download | tmwa-7a1b57a80346c1b5f2b2c5b8f0899167bf2fd9b1.tar.gz tmwa-7a1b57a80346c1b5f2b2c5b8f0899167bf2fd9b1.tar.bz2 tmwa-7a1b57a80346c1b5f2b2c5b8f0899167bf2fd9b1.tar.xz tmwa-7a1b57a80346c1b5f2b2c5b8f0899167bf2fd9b1.zip |
Fix subtle MD5 bug
Diffstat (limited to 'src/common')
-rw-r--r-- | src/common/md5calc.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/common/md5calc.c b/src/common/md5calc.c index d5ebcf8..3f2e009 100644 --- a/src/common/md5calc.c +++ b/src/common/md5calc.c @@ -198,7 +198,7 @@ MD5_state MD5_from_string(const char* msg, const size_t msglen) if (64 - rem > 8) { for (int i=0; i<8; i++) - buf[0x38+i] = (msglen*8) >> (i*8); + buf[0x38+i] = ((uint64_t)msglen*8) >> (i*8); } for (int i=0; i<0x10; i++) X[i] = buf[4*i+0] | buf[4*i+1]<<8 | buf[4*i+2]<<16 | buf[4*i+3]<<24; @@ -207,7 +207,7 @@ MD5_state MD5_from_string(const char* msg, const size_t msglen) { memset(buf,'\0', 0x38); for (int i=0; i<8; i++) - buf[0x38+i] = (msglen*8) >> (i*8); + buf[0x38+i] = ((uint64_t)msglen*8) >> (i*8); for (int i=0; i<0x10; i++) X[i] = buf[4*i+0] | buf[4*i+1]<<8 | buf[4*i+2]<<16 | buf[4*i+3]<<24; MD5_do_block(&state, block); |