private byte ReadChar ()
{
byte result;
char c = encoded [index++];
if (c >= 'A' && c <= 'F')
result = (byte) (10 + ((byte) c - (byte) 'A'));
else if (c >= 'a' && c <= 'f')
result = (byte) (10 + ((byte) c - (byte) 'a'));
else if (c >= '0' && c <= '9')
result = (byte) ((byte) c - (byte) '0');
else
throw new ArgumentException (string.Format ("Invalid hex character: '{0}'", c));
return result;
}