Initial commit - Event Planner application
This commit is contained in:
6
node_modules/uid/secure/index.d.ts
generated
vendored
Normal file
6
node_modules/uid/secure/index.d.ts
generated
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
/**
|
||||
* Produce a cryptographically secure (CSPRNG) UID of desired length using the current environment's `crypto` module.
|
||||
* @NOTE Relies on a hexadecimal alphabet (A-E, 0-9).
|
||||
* @param {number} [length] Defaults to `11`
|
||||
*/
|
||||
export function uid(length?: number): string;
|
||||
20
node_modules/uid/secure/index.js
generated
vendored
Normal file
20
node_modules/uid/secure/index.js
generated
vendored
Normal file
@@ -0,0 +1,20 @@
|
||||
const { random } = require('@lukeed/csprng');
|
||||
|
||||
var IDX=256, HEX=[], SIZE=256*16, BUFFER;
|
||||
while (IDX--) HEX[IDX] = (IDX + 256).toString(16).substring(1);
|
||||
|
||||
function uid(len) {
|
||||
var str='', tmp=(len || 11), num=(1+tmp) / 2 | 0;
|
||||
if (!BUFFER || ((IDX + num) > SIZE)) {
|
||||
BUFFER = random(SIZE);
|
||||
IDX = 0;
|
||||
}
|
||||
|
||||
while (num--) {
|
||||
str += HEX[BUFFER[IDX++]];
|
||||
}
|
||||
|
||||
return str.substring(0, tmp);
|
||||
}
|
||||
|
||||
exports.uid = uid;
|
||||
1
node_modules/uid/secure/index.min.js
generated
vendored
Normal file
1
node_modules/uid/secure/index.min.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports):"function"==typeof define&&define.amd?define(["exports"],n):n(e.uid={})}(this,(function(e){const{random:n}=require("@lukeed/csprng");for(var t,o=256,r=[];o--;)r[o]=(o+256).toString(16).substring(1);e.uid=function(e){var i="",f=e||11,u=(1+f)/2|0;for((!t||o+u>4096)&&(t=n(4096),o=0);u--;)i+=r[t[o++]];return i.substring(0,f)}}));
|
||||
18
node_modules/uid/secure/index.mjs
generated
vendored
Normal file
18
node_modules/uid/secure/index.mjs
generated
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
import { random } from '@lukeed/csprng';
|
||||
|
||||
var IDX=256, HEX=[], SIZE=256*16, BUFFER;
|
||||
while (IDX--) HEX[IDX] = (IDX + 256).toString(16).substring(1);
|
||||
|
||||
export function uid(len) {
|
||||
var str='', tmp=(len || 11), num=(1+tmp) / 2 | 0;
|
||||
if (!BUFFER || ((IDX + num) > SIZE)) {
|
||||
BUFFER = random(SIZE);
|
||||
IDX = 0;
|
||||
}
|
||||
|
||||
while (num--) {
|
||||
str += HEX[BUFFER[IDX++]];
|
||||
}
|
||||
|
||||
return str.substring(0, tmp);
|
||||
}
|
||||
Reference in New Issue
Block a user