简体   繁体   中英

How to change a binary file of well know format to something custom and undiscoverable?

I have for example a zip-file. I need to change that file (I am thinking of file header or something, some bit or byte inside) to some custom format which then can't be unzipped. On the other side I would later be able to restore the original file using inverted algorithm. May anybody help me with that ?

void encrypt(FileInputStream zip) {
  ...
}

void decrypt(FileInputStream dat) {
  ...
}

A zip file is discovered by examining the end of the file which is where the index of files contained is held.

I would consider encrypting the file first. If you need to you can encrypt the file yourself. A just simple way to do this is to XOR every byte or int (4-byte) with a fixed constant.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM