Skip to content

Instantly share code, notes, and snippets.

@ruanyl
Last active April 25, 2016 18:01
Show Gist options
  • Save ruanyl/9869631 to your computer and use it in GitHub Desktop.
Save ruanyl/9869631 to your computer and use it in GitHub Desktop.
nodejs
var Crypto = require('crypto');
function generateUUID() {
var current_date = (new Date()).valueOf().toString();
var random = Math.random().toString();
var num = Crypto.createHash('sha1').update(current_date + random).digest('hex');
return num;
}
module.exports = {
generateUUID: generateUUID
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment