Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7595213
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T21:37:04+00:00 2026-05-30T21:37:04+00:00

I have a simple PHP file which loads a file from my server, base64

  • 0

I have a simple PHP file which loads a file from my server, base64 encodes it and echoes it out.

Then I have a simple HTML page that uses jQuery to fetch this file, base64 decode it and do a checksum test. The checksum test is not working.

I md5’d the file in PHP after encoding it and md5’d it in javascript before decoding it and the checksums matched (So nothing went wrong during transit). However, the pre encoding and post decoding checksums do NOT match.

I am using webtoolkit.base64.js for decoding it in JavaScript. The file is a binary file (A ZIP archive).

Is there a problem with the decoding library or something else I’m not aware of that could cause this issue? Could it be a problem with the MD5 library I’m using (http://pajhome.org.uk/crypt/md5/md5.html)

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T21:37:05+00:00Added an answer on May 30, 2026 at 9:37 pm

    Summary
    Your MD5 library is OK, your base64 library is broken.

    Both your JavaScript Base64 library and MD5 library are not working correctly.

    1. I have created and verified a ZIP file of 15097 bytes.
      MD5 sum: a9de6b8e5a9173140cb46d4b3b31b67c
    2. I have base64-encoded this file: http://pastebin.com/2rfdTzYT (20132 bytes).
    3. Verify the length of the base64 file at pastebin, using the following JavaScript snippet:

      document.querySelector('.de1').textContent.replace(/\s/g,'').length;
    4. Base64-decode the file properly using atob, and verify the size:

      window.b64_str = document.querySelector('.de1').textContent.replace(/\s/g,'');
      console.log( atob(window.b64_str).length ); /* 15097 */
      
    5. I verified that both files were exactly equal using the Hexdump JavaScript library, and the xxd UNIX command (available as EXE file for Windows).

    Using your Base64 decoder, I get a string with the size of 8094. That is not 15097!
    During my tests, I discovered that the atob method returned incorrect bytes after certain byte sequences, including carriage returns. I have not yet found a solution to this.

    Your MD5 library is OK.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a php file which pulls some data from external API's, and I
I have a PHP page which generates an HTML table. At the bottom of
I have a simple index.php file which checks for user authentication, and if all
How to manually create Friendly URLs? (PHP) So I have created simple php file
I have a PHP file with one simple echo function: echo 'アクセスは撥ねりません。'; but when
I have a simple php script on a server that's using fsockopen to connect
I have a single PHP file which handles credit card processing. It starts as
My problem is the following: I have a real simple PHP file called writeSettings2.php
I have a PHP file for my website, index.php, which, as it stands on
I'm a bit confused here. I have a simple controller which loads a view.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.