Encoding text to hex
Each character is resolved to its Unicode code point and encoded as UTF-8: code points below 128 (ASCII) take one byte, higher ones take two, three, or four. Every byte is then written as exactly two hex digits in the range 00 to FF, so the output is always even in length and equals twice the byte count - which is not necessarily the number of characters you typed.