Search code examples
telephony

Code conversion from 8 digits to 4 digits seperated by colon


I opened a configuration file in notepad for a voice compressor and am trying to streamline changes. There is a line in the configuration that reads:

Network.NodeID 33716246

When the configuration file is loaded the result for 33716246 is 2:2:120:22

As another example I changed the NodeID number a few times and the results are as follows:

13716256 0:209:75:32

33716156 2:2:119:188

33716296 2:2:120:72

I am trying to find out how this is being converted so I can predict what number is needed to get the desired result. Thank you.


Solution

  • It's a conversion to bytes:

    33716246 =   2 * 256 ^ 3
             +   2 * 256 ^ 2
             + 120 * 256 ^ 1
             +  22 * 256 ^ 0