EnHex converts a string to hexidecimal characters, which I designed for use with encryption routines that sometimes output unprintable characters. It's a simple way to convert unprintable characters into something printable. DeHex simply reverses the process.
Inputs
EnHex Input: normal text
DeHex Input: text that has been "en-hexed"
Assumes
The assumption is that any text sent to DeHex is in fact hexidecimal. I pulled this from my own personal coding toolbox so I haven't built in any error checking because it was written for use in a very controlled environment -- such as apps I've written that use encryption.
Returns
EnHex Return: text converted into hexidecimal characters
DeHex Return: the original text that was converted to hexidecimal characters using EnHex
Side Effects
Converting a string into hexidecimal format will effectively double the size of the string (hexidecial requires two characters for every "en-hexed character), so be sure to weigh the benefits of having printable text against the size of the result. I tend to only use this if I need to send encrypted data blocks through email or if I want a user to manually enter small amounts of encrypted data, such as a one-line registration number.