It won't work on all versions but it should work back as far as 6.03 (that's the version I started using) and maybe before.

Code:
alias tohex { 
  var %hex, %i = 1
  while ($mid($1,%i,1) != $null) {
    %hex = %hex $+ $base($asc($ifmatch),10,16)
    inc %i
  }
  return %hex
}