Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

80
Vistas
baseurl64 buffer decoding

Can someone explain this behavior?

Buffer.from('5d9RAjZ2GCob-86_Ql', 'base64url').toString('base64url')

// 5d9RAjZ2GCob-86_Qg

Please take a close look at the last character l - g

over 4 years ago · Santiago Trujillo
1 Respuestas
Responde la pregunta

0

Your string is 18 characters long, With 6 Bits encoded in each character it means the first 16 characters represent 96 bytes and the last two represent one byte plus 4 unused bits. Only the first two bits of the last character are significant here. g is 100000, l is 100101. As the last 4 characters are not used, g is just the first choice for the two bits 1 0.

So for any character in the range between g and v, you would get a g when you convert it back to Base64Url. See https://en.wikipedia.org/wiki/Base64#Base64_table_from_RFC_4648

over 4 years ago · Santiago Trujillo Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda