z3635363/spymemcached

Make sure hashes are computed over UTF-8 bytes

Closed this issue · 2 comments

From Blair Zajac:

I suggest having the k.getBytes() here:

                       case CRC32_HASH:
                               // return (crc32(shift) >> 16) & 0x7fff;
                               CRC32 crc32 = new CRC32();
                               crc32.update(k.getBytes());
                               rv = (crc32.getValue() >> 16) & 0x7fff;
                               break;

and here:

               md5.reset();
               md5.update(k.getBytes());
               return md5.digest();

use getBytes("UTF-8").


Original issue reported on code.google.com by dsalli...@gmail.com on 15 Apr 2008 at 4:30

Original comment by dsalli...@gmail.com on 15 Apr 2008 at 5:00

  • Added labels: Milestone-Release2.1
Fixed in 5625170b2f735bfd9b54dfeaf3fb356b680e0eff

Original comment by dsalli...@gmail.com on 3 May 2008 at 6:29

  • Changed state: Fixed