Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F4498962
uuid.cjs
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
708 B
Referenced Files
None
Subscribers
None
uuid.cjs
View Options
function generateUUID() {
const bytes = Ant.Crypto.randomBytes(16);
bytes[6] = (bytes[6] & 0x0f) | 0x40;
bytes[8] = (bytes[8] & 0x3f) | 0x80;
const hex = function (i) {
const val = bytes[i];
const digits = '0123456789abcdef';
const hi = (val >> 4) & 0x0f;
const lo = val & 0x0f;
return digits[hi] + digits[lo];
};
return (
hex(0) +
hex(1) +
hex(2) +
hex(3) +
'-' +
hex(4) +
hex(5) +
'-' +
hex(6) +
hex(7) +
'-' +
hex(8) +
hex(9) +
'-' +
hex(10) +
hex(11) +
hex(12) +
hex(13) +
hex(14) +
hex(15)
);
}
console.log('builtin:', Ant.Crypto.randomUUID());
console.log('engine:', generateUUID());
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sun, May 3, 7:52 AM (1 d, 8 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
524242
Default Alt Text
uuid.cjs (708 B)
Attached To
Mode
rANT Ant
Attached
Detach File
Event Timeline
Log In to Comment