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

301
Vistas
Calculate client side MD5 hash of an image file to match one calculated by Firebase?

Is there a method to calculate the MD5 of an image file on the client side in my Angular Map, that will match the MD5 when I store that file on Firestore? I need to be able to confirm that a user file matches a reference version stored in firebase without having to upload it again.

I can get an array buffer from a file object on the local machine, but can't get the md5 calculation done locally to match what Firebase returns.

The result I got looks nothing like the md5 reported by Firebase, so I don't think I'm on the right track at all:

let file = target.files[0];
let reader = new FileReader();
reader.onload = function (event) {
  data = event.target.result;
  let ret: any = data;
  if (data) {
    let len = ret.byteLength;
    let uintArBuff = new Uint8Array(ret);   //Does an array buffer convert to a Uint8Array?
    let md5 = new Md5();
    let hash = md5.appendByteArray(uintArBuff).end();  
    console.log(hash);
  }  
}
reader.readAsArrayBuffer(file);

The above produced a result that looks like 29e10414c7c7b7adb61330b02f8f3ddc, while the MD5 reported by firebase is KeEEFMfHt622EzCwL4893A== so I think I'm up the wrong tree altogether. Not even the same length hash.. . .

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

0

I would have commented but reputation doesn't allow me to.

KeEEFMfHt622EzCwL4893A== is base64 encoded. Yours is hex encoded.

I just used an online converted and it checks out that they match.

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