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

300
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
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