0

If I want to store binary data (hash values) and they're always 128bytes long, what field type should I use? BLOBs are nice, but they aren't fixed width (and result in dynamic tables).. CHAR requires a charset.

Brian Tompsett - 汤莱恩
  • 5,753
  • 72
  • 57
  • 129
Ian
  • 24,116
  • 22
  • 58
  • 96
  • Personally, I'd hex or base64 encode the data to be on the safe side when switching between platforms, etc. There's also the utf8_bin charset for CHAR. But there's probably a better solution, so this is just a comment. :) – KiNgMaR Jan 08 '10 at 16:22

1 Answers1

4

You can use BINARY, so BINARY(128).

Note that if you're storing character data, then the standard character set of the operating system is used to convert the character to it's byte value, so you'd have to take any cross-platform issues into consideration.

Rich Adams
  • 26,096
  • 4
  • 39
  • 62