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

305
Views
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 answers
Answer question

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 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!