Home > Computer security programming > Advantages of hex encoding strings

Advantages of hex encoding strings

January 14th, 2008

When programming with bytes, a lot of your programming time is spent converting from hex format into byte format and then back again for debugging and testing. If your encryption package has the option, you may as well work consistently in hex format all the time. You then only need to convert the original plaintext from `text’ into a hex-encoded string before encryption and then convert back after successful decryption.

The advantages of using hex strings include

  • You can store them in normal string variables, which are usually easier to manage in programs.
  • You can pass them between different computer systems and in emails without corruption.
  • Printing is straightforward.
  • Debugging is easier as the value of each encoded byte is immediately visible.

Base64 strings have similar advantages except debugging is less convenient. On the downside, hex-encoded strings use twice as much storage as the underlying byte-encoded binary data, more if the strings are stored in Unicode format. Base64 strings expand the binary data by about four-thirds.



Computer security Computer security programming , , ,

  1. No comments yet.
  1. April 16th, 2008 at 13:22 | #1