OOPS,
Please realize that my last reply was WRONG, given the input description that you give us. You said that the input would be in "hex" (2 characters), e.g
00 = X'00'
BUT
AB = (some charcter)
would also be valid. Therefore, to use the approach I suggested, you need to
A) allow...