0

非常にユニークなMessage-Id.

Pythonが約 41 文字の長さのファイルを生成するのを確認しましたが、これは少し短すぎます。

助言がありますか?

'use strict';

var crypto = require('crypto');

// inspired by http://www.jwz.org/doc/mid.html#3

module.exports = function (hostname) {
  var hrtime = process.hrtime();
  var microseconds = hrtime[0] * 1000000 + hrtime[1] / 1000;
  var token = crypto.randomBytes(64).toString('hex');
  var b36 = parseInt(token, 16).toString(36);
  var result = '<';
  result += microseconds;
  result += b36;
  result += '@' + hostname;
  result += '>';
  return result;
};
4

1 に答える 1

0

おそらく cuid はあなたに適していますか?

于 2015-03-05T04:41:15.183 に答える