SoFunction
Updated on 2025-03-02

Nodejs Get the 32-bit identification implementation code of time plus mobile phone identifier

The specific code is as follows:

var crypto = require("crypto");
function randomlogn(num){
 var n = ('');
 var m = [];
 for(var i=0;i<16;i++){
  m[i] = n[(()*17)];
 }
 return u = ("");
}
//Random numberfunction md5(text) {
 return ('md5').update(text).digest('hex');
};
/**
  * Function: randomly generate an identifier
  * @param : string [time] 13-bit timestamp string data The phone's identifier
  * @return: string data 32-bit string
 */
 = function(time, data) { // Time 13 Identification 15 digits Random 4 digits var g,o,h;
 g = md5(data).substr(16, 32);
 o = randomlogn(g);
 h = randomlogn(o);
 if (!time) {
  time = new Date().getTime()
 };
 var str = "",
  arr = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z'];
 // Random generation for(var i = 0; i < 4; i++) {
  pos = (() * ( - 1));
  str += arr[pos];
 }
 return time + h + str
}

The above is the implementation code for Nodejs to obtain the 32-bit logo with time plus mobile phone logo introduced by the editor. I hope it will be helpful to everyone. If you have any questions, please leave me a message and the editor will reply to everyone in time. Thank you very much for your support for my website!