Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

node-uuid is much better.

  • Loading branch information...
commit 67d753fec99fa1f5a3b35ec0bbbc98896418d86c 1 parent c7a8be6
@mikeal mikeal authored
Showing with 3 additions and 21 deletions.
  1. +1 −1  main.js
  2. +2 −1  package.json
  3. +0 −19 uuid.js
View
2  main.js
@@ -22,7 +22,7 @@ var http = require('http')
, crypto = require('crypto')
, oauth = require('./oauth')
, hawk = require('hawk')
- , uuid = require('./uuid')
+ , uuid = require('node-uuid')
, ForeverAgent = require('./forever')
, Cookie = require('./vendor/cookie')
, CookieJar = require('./vendor/cookie/jar')
View
3  package.json
@@ -23,7 +23,8 @@
"dependencies": {
"form-data": "~0.0.3",
"mime": "~1.2.7",
- "hawk": "~0.8.1"
+ "hawk": "~0.8.1",
+ "node-uuid": "~1.4.0"
},
"scripts": {
"test": "node tests/run.js"
View
19 uuid.js
@@ -1,19 +0,0 @@
-module.exports = function () {
- var s = [], itoh = '0123456789ABCDEF'
-
- // Make array of random hex digits. The UUID only has 32 digits in it, but we
- // allocate an extra items to make room for the '-'s we'll be inserting.
- for (var i = 0; i <36; i++) s[i] = Math.floor(Math.random()*0x10)
-
- // Conform to RFC-4122, section 4.4
- s[14] = 4; // Set 4 high bits of time_high field to version
- s[19] = (s[19] & 0x3) | 0x8 // Specify 2 high bits of clock sequence
-
- // Convert to hex chars
- for (var i = 0; i <36; i++) s[i] = itoh[s[i]]
-
- // Insert '-'s
- s[8] = s[13] = s[18] = s[23] = '-'
-
- return s.join('')
-}
Please sign in to comment.
Something went wrong with that request. Please try again.