Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

183
Views
Convertir byteArray grande a wordArray

Necesito convertir una gran matriz (Uint8Array(224337596)) dentro de mi código. Aparentemente, el tamaño es demasiado grande y hace que el navegador se bloquee.

¿Hay alguna solución para tal vez esto en trozos?

 var encrypted = convertUint8ArrayToWordArray(mergedArray) function convertUint8ArrayToWordArray(u8Array) { var words = [], i = 0, len = u8Array.length; while (i < len) { words.push( (u8Array[i++] << 24) | (u8Array[i++] << 16) | (u8Array[i++] << 8) | (u8Array[i++]) ); } return { sigBytes: words.length * 4, words: words }; }
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Si la ventana de su navegador se congela, puede procesar la matriz de forma asíncrona en lotes. He puesto el ejemplo en un fragmento

 function pause() { return new Promise(r => setTimeout(r, 0)) } async function convertUint8ArrayToWordArray(u8Array) { var words = [], i = 0, len = u8Array.length; while (i < len) { words.push( (u8Array[i++] << 24) | (u8Array[i++] << 16) | (u8Array[i++] << 8) | (u8Array[i++]) ); if (i % 100000 == 0) { await pause(); } } return { sigBytes: words.length * 4, words: words }; } const bigArray = new Uint8Array(224337596); for (let idx = 0; idx < bigArray.length; ++idx) { bigArray[idx] = Math.floor(Math.random() * 256); } convertUint8ArrayToWordArray(bigArray).then((res) => { console.log(res.words[0]) });

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!