Skip to content
TG007 community snippet #126

Convert Hex IP to Dec by gennarino

Routine to convert an Hex IP in a Decimal IP

By Snippets Added Dec 4, 2023
General IRC All snippets
mIRC script 25 lines
About this snippet

Overview

Routine to convert an Hex IP in a Decimal IP
Source code

mIRC script

25 lines · 520 characters
/* 
Routine to convert an Hex IP in a Decimal IP

Use:     %res = $Hex2IP( hex_IP )

Alias h2d is used for test purpose only.
Try::     /h2d 598af63b
Output:     89.138.246.59
*/

alias h2d   {
  var %a = $Hex2IP( $1 )
  .echo 4 -a %a
}

alias -l Hex2IP {
  var %id = $1

  var %d1 = $mid(%id, 0, 2)
  var %d2 = $mid(%id, 3, 2)
  var %d3 = $mid(%id, 5, 2)
  var %d4 = $mid(%id, 7, 2)

  return  $base( %d1,16,10 ) $+ . $+ $base( %d2,16,10 ) $+ . $+ $base( %d3,16,10 ) $+ . $+ $base( %d4,16,10 )
}
Community

Comments

Want to join the discussion? Sign in to TG007.
No comments yet. Start the discussion.