Answer the question
In order to leave comments, you need to log in
What is the optimal HEX -> DOMAIN conversion algorithm?
I call the conversion algorithm , for example, Base64 or Punicode.
You need to compress the IP address to match the following regular expression: (a-z0-9\-)+
. I use this to convert IP to domain. For example, this is reduced by at least a couple of characters:, 127.0.0.1 -> 7F.0.0.1
but this is not the best option, because not used j-z
and "-"
. How to do this, are there similar algorithms?
If the question "what the x .., what is the IP -> domain ??" is spinning, you are here .
Answer the question
In order to leave comments, you need to log in
127.0.0.1 can be represented as an unsigned byte (0-255) array of 4 elements.
We pack the resulting array into unsigned int32
C++ example
inline uint32_t PACK(uint8_t c0, uint8_t c1, uint8_t c2, uint8_t c3) {
return (c0 << 24) | (c1 << 16) | (c2 << 8) | c3;
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question