开发者

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

开发者 https://www.devze.com 2023-01-22 06:34 出处:网络
I have video files, that I want to pad with a random number of extra bytes, in order to create a different md5 checksu开发者_JAVA百科m. Is there a way to do that, and keep them playable? It depends on

I have video files, that I want to pad with a random number of extra bytes, in order to create a different md5 checksu开发者_JAVA百科m. Is there a way to do that, and keep them playable?


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


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号