Jump to content

lie to server about md5sum of a file

babadoctor
Go to solution Solved by Eigenvektor,
7 hours ago, babadoctor said:

or somehow calculate the hash of the file incrementally as it is created?

Depends on how you're creating the file. To calculate the hash, the file is read from beginning to end and fed through the hash algorithm. If you're creating the file programmatically you can absolutely generate the hash while you're writing it to a file, by feeding the bits through the hash digest as you're writing the bits to disk.

 

For example, the server can do this while it is receiving the file. As the file is written to disk, it can also send the stream through the hash algorithm at the same time. Unfortunately the sender can't do that because you need to present the MD5 to the server as a header before the file is sent, otherwise you could generate it as you're going over the file to send it.

I want to upload very large files to a server, but according to some convention (i dont remember which one, it might be multipart data), it requires me to calculate an md5 hash of the file before uploading, and then the server checks to see if the md5 sum i provided is correct. if not the upload is aborted

 

is there any way I can "lie" to the server and tell it that it has the right hash?

 

or somehow calculate the hash of the file incrementally as it is created?

 

the file in question is created over a period of 12 hours, and data is added to it. is there any way to calculate the hash incrementally so the computer does not need  to do it all at once?

 

hashing a 50GB file is too much for the computer hosting it to do, so any support would be appreciated

OFF TOPIC: I suggest every poll from now on to have "**CK EA" option instead of "Other"

Link to comment
Share on other sites

Link to post
Share on other sites

6 hours ago, babadoctor said:

is there any way I can "lie" to the server and tell it that it has the right hash?

I sure hope not. That'd completely undermine the point of hashes in the first place.

ENCRYPTION IS NOT A CRIME

Link to comment
Share on other sites

Link to post
Share on other sites

7 hours ago, babadoctor said:

or somehow calculate the hash of the file incrementally as it is created?

Depends on how you're creating the file. To calculate the hash, the file is read from beginning to end and fed through the hash algorithm. If you're creating the file programmatically you can absolutely generate the hash while you're writing it to a file, by feeding the bits through the hash digest as you're writing the bits to disk.

 

For example, the server can do this while it is receiving the file. As the file is written to disk, it can also send the stream through the hash algorithm at the same time. Unfortunately the sender can't do that because you need to present the MD5 to the server as a header before the file is sent, otherwise you could generate it as you're going over the file to send it.

Remember to either quote or @mention others, so they are notified of your reply

Link to comment
Share on other sites

Link to post
Share on other sites

3 hours ago, Eigenvektor said:

Unfortunately the sender can't do that because you need to present the MD5 to the server as a header before the file is sent, otherwise you could generate it as you're going over the file to send it.

you could however create the hash as you create the file.

                     ¸„»°'´¸„»°'´ Vorticalbox `'°«„¸`'°«„¸
`'°«„¸¸„»°'´¸„»°'´`'°«„¸Scientia Potentia est  ¸„»°'´`'°«„¸`'°«„¸¸„»°'´

Link to comment
Share on other sites

Link to post
Share on other sites

10 hours ago, vorticalbox said:

you could however create the hash as you create the file.

Yes, which mentioned in the first paragraph of my post ;)

Remember to either quote or @mention others, so they are notified of your reply

Link to comment
Share on other sites

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×