mirror of
https://github.com/misode/misode.github.io.git
synced 2026-04-29 09:32:43 +00:00
8 lines
228 B
TypeScript
8 lines
228 B
TypeScript
const dec2hex = (dec: number) => ('0' + dec.toString(16)).substr(-2)
|
|
|
|
export function hexId(length = 12) {
|
|
var arr = new Uint8Array(length / 2)
|
|
window.crypto.getRandomValues(arr)
|
|
return Array.from(arr, dec2hex).join('')
|
|
}
|