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

317
Vistas
How to achieve Base64.getDecoder().decode(nonceBase64Encoded) in JavaScript?

I have some code written in java which I want to convert to JavaScript.

String nonceBase64Encoded = "+8GorZIWoF7mnZ2/M86/eA==";    
byte[] decodednoncebytes = Base64.getDecoder().decode(nonceBase64Encoded);

About this decode():

Decodes a Base64 encoded String into a newly-allocated byte arrayusing the Base64 encoding scheme.

An invocation of this method has exactly the same effect as invoking decode(src.getBytes(StandardCharsets.ISO_8859_1))

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

The atob() function decodes a string of data which has been encoded using Base64 encoding. read more

example:

var decodedData = atob(encodedData);

The btoa() method creates a Base64-encoded ASCII string from a binary string (i.e., a String object in which each character in the string is treated as a byte of binary data). read more

example:

var encodedData = btoa(stringToEncode);

And if you want to convert strings into array of bytes then TextEncoder can be used:

new TextEncoder().encode(str)

Alternatively this function could be used:

function stringToByteArray(s){

    // Otherwise, fall back to 7-bit ASCII only
    var result = new Uint8Array(s.length);
    for (var i=0; i<s.length; i++){
        result[i] = s.charCodeAt(i);/* w ww. ja  v  a 2s . co  m*/
    }
    return result;
}
about 4 years ago · Juan Pablo Isaza 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