summaryrefslogtreecommitdiff
path: root/modules/uniqueid.js
diff options
context:
space:
mode:
authorMinteck <contact@minteck.org>2022-01-20 13:43:34 +0100
committerMinteck <contact@minteck.org>2022-01-20 13:43:34 +0100
commitc2aa7bf38fb30de2d04f87f8e7780e4c768ae6b1 (patch)
tree226598e8d17d20e3721358f7c60b1cc6b851163a /modules/uniqueid.js
downloadcobalt-c2aa7bf38fb30de2d04f87f8e7780e4c768ae6b1.tar.gz
cobalt-c2aa7bf38fb30de2d04f87f8e7780e4c768ae6b1.tar.bz2
cobalt-c2aa7bf38fb30de2d04f87f8e7780e4c768ae6b1.zip
Initial commit
Diffstat (limited to 'modules/uniqueid.js')
-rw-r--r--modules/uniqueid.js11
1 files changed, 11 insertions, 0 deletions
diff --git a/modules/uniqueid.js b/modules/uniqueid.js
new file mode 100644
index 0000000..cbf4965
--- /dev/null
+++ b/modules/uniqueid.js
@@ -0,0 +1,11 @@
+const crypto = require('crypto');
+
+module.exports = function DocCMSUniqueID(file) {
+ if (typeof file !== "undefined") {
+ salt = file;
+ } else {
+ salt = crypto.randomBytes(64).toString("hex");
+ }
+
+ return parseInt(crypto.createHash("sha512").update(salt, "utf-8").digest("hex").substring(0, 16), 16).toString().substring(0, 18);
+} \ No newline at end of file