Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

258
Visualizações
UUIDv6, v7, v8 in Javascript (Browser)

I have been trying to find Javascript solutions for generating UUIDs in the browser. The ones I have found generate UUIDs following the version 4 standard.

Example:

function uuidv4() {
  return ([1e7]+-1e3+-4e3+-8e3+-1e11).replace(/[018]/g, c =>
    (c ^ crypto.getRandomValues(new Uint8Array(1))[0] & 15 >> c / 4).toString(16)
  );
}

console.log(uuidv4());

or even

let uuid = self.crypto.randomUUID();
console.log(uuid);

Are the other versions impossible to generate in the browser because they use MAC addresses (and those are inaccessible in JS due to privacy concerns)?

As I understand it, V6 is mostly UUIDv1 with some reordering (Draft), so it's not possible to use either. But how about V7 and V8? Is there an aspect preventing online (client-side) use? Or could the V4 code be adapted to produce those?

about 4 years ago · Santiago Gelvez
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda