summaryrefslogtreecommitdiff
path: root/src/lib/uuid.js
diff options
context:
space:
mode:
authorhackademix2018-07-01 01:01:23 +0200
committerhackademix2018-07-01 01:01:23 +0200
commiteceae7187a6f0e9510bc1165f6977256b87f490f (patch)
treed943f1ec73c09efa70954dcedb55eac82a726148 /src/lib/uuid.js
downloadnoscript-eceae7187a6f0e9510bc1165f6977256b87f490f.tar.gz
noscript-eceae7187a6f0e9510bc1165f6977256b87f490f.tar.xz
noscript-eceae7187a6f0e9510bc1165f6977256b87f490f.zip
Initial commit starting at version 10.1.8.3rc4.
Diffstat (limited to 'src/lib/uuid.js')
-rw-r--r--src/lib/uuid.js6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/lib/uuid.js b/src/lib/uuid.js
new file mode 100644
index 0000000..d809437
--- /dev/null
+++ b/src/lib/uuid.js
@@ -0,0 +1,6 @@
+'use strict';
+function uuid() {
+ return ([1e7]+-1e3+-4e3+-8e3+-1e11).replace(/[018]/g,
+ c => (c ^ crypto.getRandomValues(new Uint8Array(1))[0] & 15 >> c / 4)
+ .toString(16));
+}