Is there a way to pad files with a few extra bytes to get a different md5 checksum?

StackOverflow https://stackoverflow.com/questions/4027983

  •  26-09-2019
  •  | 
  •  

Question

I have video files, that I want to pad with a random number of extra bytes, in order to create a different md5 checksum. Is there a way to do that, and keep them playable?

Was it helpful?

Solution

It depends on the video file format, but you should be able to just add the extra bytes to the end, and most video players should ignore them. Most video formats contain a lot of metadata about the video data (such as "the total video size is X bytes"), so they're robust against this sort of change.

One simple way to do this is to use the >> shell redirection operator to append data, e.g.:

# Add 32 random bytes to the end of the movie.avi
head -c 32 /dev/urandom >> movie.avi

OTHER TIPS

Metadata would be a good thing to change. If the file has metadata about the time the film was made or the software used for encoding, changes to those values should not have any effect on the final result. You'd need to specify the format.

Yegor,

It depends entirely on the video format. Look it up on wikipedia, some have a end of file flag byte sequence, simply adding bytes after it will achieve your effect, others will not work out so simply.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top