for convert decimal to hexadecimal (not only one byte) can be used:
for convert hexadecimal to decimal, on RouterOS already exist this two methods (0x must be present):
:put 0xFF85
:put [:tonum "0xFF85"]
but this can be used (not only one byte):
:global hex2dec do={
:local conv $1
:if (!($conv~"^[0-9a-fA-F]+\$")) do={:return 0}
:if ([:typeof [:find $conv "0x" -1]] = "nil") do={:set conv "0x$conv"}
:return [:tonum $conv]
}
WARNING: RouterOS have a bug that do not recognize negative hex values, on future I mod the previous script to support QWORD hex conversion