# hex2oct

This function converts a single hexstring value to a single octetstring. The resulting octetstring represents the same value as the hexstring.

For the purpose of this conversion, a hexstring should be converted into a octetstring, where the octetstring contains the same sequence of hex digits as the hexstring when the length of the hexstring modulo 2 is 0. Otherwise, the resulting octetstring contains 0 as leftmost hex digit followed by the same sequence of hex digits as in the hexstring.

Related keyword:

- octetstring
- hexstring

### hex2oct(hexstring value) return octetstring

Example 1:

const octetstring c_kaprifol := hex2oct('7AA'H);

The constant called c_kaprifol will contain the octet string 07AA. The resulting octet string contains 0 as leftmost hex digit followed by the same sequence of hex digits as in the hexadecimal string because the number of the hexadecimal digits is odd.