c++ - 10 character id that's globally and locally unique -


I need to generate a 10 character unique ID (SIP / VOIP people will need to know that it is a param icid- Value is p-charging-vector header) Each character will be one of the 26 ASCII characters (case sensitive), one of the 10 ASCII points or one of the hyphen-minus.

It should be unique globally (outside the machine outside the machine) 'and' locally unique (within the machine in the production of IDs) ', and pack them all into 10 characters Need, fuzzy!

Here I have to take it. I am the first encoding. It is important to have a unique local IP address globally at Aadhar-63 (its an unsigned long term which is 1-6 after the encoding Will capture) and then as much as I currently have the stamp (depending on how much space a time_t / long long int encoded IP address capturing a 9/4 characters after its encoding).

I have also added loop count to the stamp so that the function is said more than once in a matter of maintaining specialty.

Is it great at the world level and locally unique or is there a better way?

Glory

  #include & lt; Stdio.h & gt; #include & lt; String.h & gt; # Include & lt; Sys / time.h & gt; // base-63 character fixed four set set [] = "abcdefghijklmnopqrstuvwxyz ABCDFGHIJLLMNOPQRTUVWXYZ 0123456789-"; // B63 () gives the next blank space in the four Sir Array XItB63 (long-term, four * x, int index) {if (index> 9) return index + 1; // printf ("index =% d, longlong =% lld, longlong% 63 =% lld \ n", index, longlong, longlong% 63); If (longline and lt; 63) {x [index] = set [long time]; Return Index + 1; } X [index] = set [long long% 63]; Returns B63 (LongLang / 63, X, Index + 1); } Int main () {char x [11], y [11] = {0}; / * '\ 0' has been taken care of here to generate 10 million IDs for / (let i = 0; i & lt; 10000000; i ++) {/ * I call sub-second function To add care, add the timestamp, 3770168404 (n / w is a sample IP address in the byte order) = 84.52.184.224 * / B63 ((long up to) time (zero) + i, x, b63 ((long Up to the time) 3770168404, X, 0)); // To get the proper base, reverse-four arrays (-en-j = 0, k = 9; j & lt; 10; j ++, k--) y [j] = -63 for x [k] output ; Printf ("% s \ n", y); } Return 0; }  

This should be unique globally (ID outside the machine) 'And sufficiently' locally unique (within the machine in the production of the ID) ', and all of them need to be packed in 10 characters, Oops!

Do you create all software IDs? Are you dodging the ID? If not ...

I do not know anything about SIP, but there can be a misconception that you have a speck (or imagination should be wrong). If any other developer tries to create an ID using one of your algorithms, then you will collide with your ID, which means that they will be unique globally in that system.

Go back to the DIP document, see if there is an appendix with an algorithm to create these IDs. Or it may be that a clever SU can answer the user that what is the SIP algorithm for creating these IDs.


Comments

Popular posts from this blog

c# - How to capture HTTP packet with SharpPcap -

php - Multiple Select with Explode: only returns the word "Array" -

php - jQuery AJAX Post not working -